How to disable default banner in spring boot
You would have seen below spring boot banner when starting a spring boot application
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
There are multiple ways to disable spring boot banner as follows:
1. SpringBootApplication main method
@SpringBootApplication
public class SpringBootDemoApplication {
public static void main(String[] args) throws Exception {
SpringApplication app = new SpringApplication(SpringBootDemoApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}
Three possible values of Banner.Mode are as follows:-
OFF – Disable printing of the banner.
CONSOLE – Print the banner to System.out.
LOG – Print the banner to the log file
2. application.properties
spring.main.banner-mode=off
3. application.yml
spring:
main:
banner-mode:"off"
4. command-line parameter
$ java -jar -Dspring.main.banner-mode=off spring-boot-app-1.0.jar
OR
$ java -jar spring-boot-app-1.0.jar --spring.main.banner-mode=off