Custom banner in spring boot application

Carvia Tech | August 03, 2019 | 2 min read | 179 views


When we start any spring boot app, it comes up with a default ascii banner on the console. In this tutorial we will learn how to create a custom banner for app startup.

This is really a two step process:

  1. Generate Ascii text banner using online tool

  2. Save it in src/main/resources/banner.txt file

Step 1. Creating custom ascii banner

We will use an online Spring Boot Ascii Banner generator to create custom banner which will be displayed during the application startup. There are multiple sites that allow us to do this:

You can use any of the above to generate text of your choice.

Step 2. Configuring banner in Spring Boot

Now we have created banner text, we need to save this text file with name banner.txt under src/main/resources so that Spring Boot can pick it up and display it at application startup.

Spring Boot by default will pick content from the banner.txt file under resources folder and display it on the startup.

If you want, you can customize this behaviour by specifying custom location for banner text, which can be configured in application.properties file using banner.location property.

application.properties
spring.banner.location=classpath:custom-banner.txt
Here is the sample program output
,--.   ,--.         ,--.
|  |   |  |  ,---.  |  |  ,---.  ,---.  ,--,--,--.  ,---.
|  |.'.|  | | .-. : |  | | .--' | .-. | |        | | .-. :
|   ,'.   | \   --. |  | \ `--. ' '-' ' |  |  |  | \   --.
'--'   '--'  `----' `--'  `---'  `---'  `--`--`--'  `----'


2019-05-24 00:03:12.334  INFO 7191 --- [           main] com.shunya.comments.ShunyaApp            : The following profiles are active: dev,default
2019-05-24 00:03:13.185  INFO 7191 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
GIF and Image support

In addition to a text file, you can also add a banner.gif, banner.jpg, or banner.png image file to your classpath or set the spring.banner.image.location property. Images are converted into an ASCII art representation and printed above any text banner.

That’s it. For more information, you can refer to Spring Boot documentation:


Top articles in this category:
  1. Run method on application startup in Spring Boot
  2. Setting a Random Port in Spring Boot Application at startup
  3. Running Spring Boot app as a service in unix
  4. Spring Boot 2.0 Reactive Web Performance Metrics
  5. Prevent Lost Updates in Database Transaction using Spring Hibernate
  6. How will you test web layer in Spring Boot using WebMvcTest annotation?
  7. What is new in Spring Boot 2



Find more on this topic:
Spring Framework image
Spring Framework

Spring Framework - MVC, Dependency Injection, Spring Hibernate, Spring Data JPA, Spring Boot and Spring Cloud for Microservices Architecture.

Last updated 1 week ago


Recommended books for interview preparation:

This website uses cookies to ensure you get the best experience on our website. more info