How to disable spring logo banner in spring boot?
By default, all spring boot applications will show up below spring logo banner in all spring boot applications.
Spring Logo Banner in Spring Boot Application Start up logs |
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.2.RELEASE)
|
We can disable spring logo in various ways using Banner.Mode. Banner.Mode comes with there options:
CONSOLE: Print the banner to System.out.
LOG: Print the banner to the log file.
OFF: Disable printing of the banner.
You can update banner mode in application.properties file as shown below:
application.properties |
spring.main.banner-mode=off
|
You can also update it in SpringApplication class as shown below:
SpringBootWebApplication |
package com.java2novice.springboot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootWebApplication {
private static Logger logger = LoggerFactory.getLogger(SpringBootWebApplication.class);
public static void main(String[] args) throws Exception {
SpringApplication springApp = new SpringApplication(SpringBootWebApplication.class);
springApp.setBannerMode(Banner.Mode.OFF);
springApp.run(args);
}
}
|
Also you can update it through command line arguments:
Terminal |
$ java -Dspring.main.banner-mode=off -jar myAppBundle.jar
|
|