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"
Note the space after the colon in banner-mode: "off" — YAML requires it to treat this as a key: value mapping. Without it (banner-mode:"off"), the parser treats the whole thing as a single plain-scalar string instead, and the property is never set.
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
Replacing the Banner Instead of Disabling It
Rather than turning the banner off, you can replace it with your own by adding a banner.txt file to src/main/resources — Spring Boot picks it up automatically at startup and prints its contents instead of the default ASCII art. It supports a handful of placeholders you can use inside the text, including ${application.version}, ${spring-boot.version}, and ${application.formatted-version}, which are resolved against your app’s version and the Spring Boot version on the classpath. This only takes effect when Banner.Mode is not OFF — setting banner-mode=off suppresses banner.txt too, since there’s no banner phase for it to run in.
Gotchas
LOGmode doesn’t mean “printed with visible log formatting.”Banner.Mode.LOGwrites the banner through the configuredLogger(atINFOlevel) instead of directly toSystem.out. If your log level is set aboveINFO, or your logging configuration filters it, the banner silently disappears from the log output even though you didn’t explicitly disable it.- Property key casing/format. Like most Spring Boot properties,
banner-modefollows the standard kebab-case convention in.properties/.ymlfiles and binds to theBanner.Modeenum values case-insensitively (off,OFF, andOffare all accepted) — but the enum constants themselves in Java code (Banner.Mode.OFF) must be written in uppercase since they’re plain Java enum values, not relaxed-bound properties. - This only affects Spring Boot’s own banner. Disabling it has no effect on anything your application itself prints to the console at startup, such as messages inside
CommandLineRunner/ApplicationRunnerbeans or your own logging statements.