On starting a Spring Boot application, you must have seen the Spring Logo Banner.
This tutorial will show you how to Turn it Off or Customize the Banner.
Turning Off the Banner
You can create an instance of SpringApplication class and modify the defaults, like turning off the Banner in this way.
import org.springframework.boot.Banner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootApp { public static void main(String[] args) { SpringApplication app = new SpringApplication(SpringBootApp.class); app.setBannerMode(Banner.Mode.OFF); app.run(args); } }
This way if you run the Application it won’t show the default Spring Banner on the startup.
Customising the Banner
You can also change the Banner text and add more values to it by creating a banner.txt
file on your classpath. I created a banner.txt file under src/main/resources. With following text.
/$$$$$$$ /$$$$$$$ /$$ /$$ | $$____/ | $$__ $$ | $$| $$ | $$ | $$ \ $$ /$$$$$$ | $$| $$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$ | $$$$$$$ | $$$$$$$ |____ $$| $$| $$ /$$__ $$ /$$__ $$| $$__ $$ /$$_____/ |_____ $$| $$__ $$ /$$$$$$$| $$| $$| $$ \ $$| $$ \ $$| $$ \ $$| $$$$$$ /$$ \ $$| $$ \ $$ /$$__ $$| $$| $$| $$ | $$| $$ | $$| $$ | $$ \____ $$ | $$$$$$/| $$$$$$$/| $$$$$$$| $$| $$| $$$$$$/| $$$$$$/| $$ | $$ /$$$$$$$/ \______/ |_______/ \_______/|__/|__/ \______/ \______/ |__/ |__/|_______/
You can also make use of the Spring variables to display additional information. Like if you put ${spring-boot.version}
in your banner.txt file. It will add the spring boot version you are using.
More variables which are provided by Spring Boot are given in the below table.
If we run the application with out custom ANSI based text , It will print the following Banner in console.