The Disable Spring Boot logo banner tutorial shows you some ways to disable Spring logo in Spring Boot web application. In Spring Boot, the default logo is Spring logo. We can disable this logo with command line, or in the java source code, or update properties file.
Other interesting posts you may like
Let’s begin:
Update the Properties & Yaml file
Update the Properties file: create your properties file and place it in the classpath directory, for example.
/src/main/resources/application.properties
1 2 |
# turn off spring boot banner spring.main.banner-mode=off |
YAML file: create your yaml file and place it in the classpath directory, for example.
/src/main/resources/application.yml
1 2 3 4 |
# turn off spring boot banner spring: main: banner-mode=off |
Update via Java code
We create a component which implements EmbeddedServletContainerCustomizer and this overrides properties and yaml settings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
package com.javabycode; import org.springframework.boot.Banner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootConsoleApplication { public static void main(String[] args) throws Exception { SpringApplication app = new SpringApplication(SpringBootConsoleApplication.class); app.setBannerMode(Banner.Mode.OFF);// turn off Spring logo app.run(args); } } |
Using Command Line
Change the Spring logo by passing the system properties directly. For example, we have a jar file named spring-boot-change-logo-1.0.jar. We run the below command to change logo.
1 |
java -Dspring.main.banner-mode=off -jar spring-boot-change-logo-1.0.jar |
That’s all on the Disable Spring Boot logo banner.
References
Spring Boot Banner