Spring Boot Banner Customization Enable / Disable

In Spring Boot by default configure for Banner “Spring Boot” as below which will display on your console with version number.

Spring Boot Banner

Possible Values for Spring Boot Banner

Spring Boot support these three types of configuration for Banner:

  • OFF : Disable printing of Banner
  • CONSOLE : Display Banner to System.out
  • LOG : Display Banner on your Log also.

How to set these Spring Boot Banner Configuration?

There are two ways to configure Spring Boot Banner:

  • Banner setting by application.properties / applictaion.yml

You can add this property in application.properties/ application.yml file to change in configuration of Banner. If you set as off will not display in console and log.

application.properties

##possible values off, console, log
spring.main.banner-mode=console

application.yml

##possible values off, console, log
spring
  main
    banner-mode:console
  • Banner Setting in Spring Boot main() method

You can also change in Spring Boot class main() method to set Banner configuration as below in this case no setting required on application properties file.

Spring Boot Banner Setting
  • Customize Spring Boot Banner

By default Spring Boot show default banner “Spring Boot” with version number. If you want to customize this banner and replace it then create one banner.txt file and place it on your Spring boot application resource folder.

Example:

${Ansi.RED}                  $$$        $$$$$      $$$$         $$$$     $$$$$
${Ansi.GREEN}                  $$$       $$$$$$$     $$$$         $$$$    $$$$$$$
${Ansi.BLUE}                  $$$       $$$$$$$     $$$$$       $$$$$    $$$$$$$
${Ansi.RED}                  $$$       $$$$$$$      $$$$       $$$$     $$$$$$$
${Ansi.GREEN}                  $$$      $$$$ $$$$     $$$$$     $$$$$    $$$$ $$$$
${Ansi.BLUE}                  $$$      $$$$ $$$$      $$$$     $$$$     $$$$ $$$$
${Ansi.RED}                  $$$     $$$$$ $$$$$     $$$$     $$$$    $$$$$ $$$$$
${Ansi.GREEN}                  $$$     $$$$   $$$$     $$$$$   $$$$$    $$$$   $$$$
${Ansi.BLUE}                  $$$     $$$$   $$$$      $$$$   $$$$     $$$$   $$$$
${Ansi.RED}                  $$$    $$$$$   $$$$$     $$$$$ $$$$$    $$$$$   $$$$$
${Ansi.GREEN}                  $$$    $$$$$$$$$$$$$      $$$$ $$$$     $$$$$$$$$$$$$
${Ansi.BLUE}          $$$$   $$$$    $$$$$$$$$$$$$      $$$$ $$$$     $$$$$$$$$$$$$
${Ansi.RED}          $$$$   $$$$   $$$$$$$$$$$$$$$      $$$$$$$     $$$$$$$$$$$$$$$
${Ansi.GREEN}          $$$$$ $$$$$   $$$$       $$$$      $$$$$$$     $$$$       $$$$
${Ansi.BLUE}          $$$$$$$$$$$  $$$$$       $$$$$     $$$$$$$    $$$$$       $$$$$
${Ansi.RED}           $$$$$$$$$   $$$$         $$$$      $$$$$     $$$$         $$$$
${Ansi.GREEN}            $$$$$$$    $$$$         $$$$      $$$$$     $$$$         $$$$

${Ansi.RED} :: Spring Boot${spring-boot.formatted-version} :: ${Ansi.DEFAULT}

Once you will run your application will show updated banner as below.

Customize Spring Boot Banner

Let me know your thoughts on it.

Happy Learning !!!