In a Spring Boot application, the console startup banner is driven by a file named banner.txt. Place it under src/main/resources to replace the default Spring artwork.
Composing the Banner
The file supports plain text, ASCII art, and property placeholders using ${...} syntax. Colors are applied via ${AnsiColor.xxx} constants defined in org.springframework.boot.ansi.AnsiColor.
${AnsiColor.BRIGHT_CYAN}
____ _ ____ _
/ ___| _ __ _ __ ___ (_) ___ __| __ ) __ _ _ __ | | __
\___ \| '_ \| '__/ _ \| |/ _ \/ _` | _ \ / _` | '_ \| |/ /
___) | |_) | | | (_) | | __/ (_| | |_) | (_| | | | | <
|____/| .__/|_| \___/|_|\___|\__,_|____/ \__,_|_| |_|_|\_\
|_|
${AnsiColor.BRIGHT_WHITE}
Application: ${spring.application.name} v${application.version}
Active Profile: ${spring.profiles.active}
Available built‑in placeholders include application.version, spring.application.name, spring.profiles.active, local.date, local.time, aswell as random generators such as ${random.int}. Custom properties defined in application.properties or application.yml can also be referenced.
application.properties
app.description=Order Management Service
banner.txt
${app.description}
Banner Location
The default path is classpath:banner.txt. To use a different file, set the location:
application.yml
spring:
banner:
location: static/custom-banner.txt
Controlling Display
Banner mode is controlled via the enum org.springframework.boot.Banner.Mode with values OFF, CONSOLE, and LOG. The default is CONSOLE.
Disable via Configuration
application.properties
spring.main.banner-mode=off
Disable Programmatically
When launching the application, set the mode directly on the SpringApplication instance or use the builder:
new SpringApplicationBuilder(MyApplication.class)
.bannerMode(Banner.Mode.OFF)
.run(args);
Alternatively, set bannerMode on a SpringApplication object:
SpringApplication app = new SpringApplication(MyApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
Programmatic Banner
For full control, implement the Banner interface and register it:
SpringApplication app = new SpringApplication(MyApplication.class);
app.setBanner((environment, sourceClass, out) -> {
out.println("Custom programmatic banner");
});
app.run(args);