HomeSpring BootSpring Boot Banner Customization: banner.txt, Colors, Disable
Spring Boot

Spring Boot Banner Customization: banner.txt, Colors, Disable

Customize the Spring Boot banner: banner.txt, ANSI colors, image banners, version variables, disable or log it, and a custom Banner class. Examples included.

Spring Boot Banner Customization in 30 Seconds

The Spring Boot banner is the ASCII art block printed at startup. To replace it, create src/main/resources/banner.txt. To turn it off, set spring.main.banner-mode=off. That covers most needs. Quick reference: - Custom text banner: banner.txt on the classpath (or spring.banner.location for another path) - Image banner: banner.gif, banner.jpg or banner.png (converted to ASCII art; printed above any text banner) - Variables: ${application.version}, ${spring-boot.version}, ${application.title}, any property from the Environment, plus ${AnsiColor.*}, ${AnsiBackground.*} and ${AnsiStyle.*} - Mode: spring.main.banner-mode = console (default), log or off - Colors: spring.output.ansi.enabled = detect (default), always or never - Code: SpringApplication.setBanner(new MyBanner()), which is only a fallback (see the programmatic section) Two things surprise people. First, ${application.version} is read from the jar manifest, so it is blank when you run from an IDE. Second, if both banner.txt and an image exist, both are printed.

The Default Banner

Every Spring Boot application prints an ASCII art banner to the console at startup. The default banner shows the Spring logo and the Spring Boot version. It has a practical use beyond aesthetics: it confirms which application started and which Spring Boot version it runs on, which helps when many services log into the same terminal or log stream. The banner is printed after the environment (properties, profiles) is prepared but before the application context and beans are created, so it is among the first output you see, and configuration files such as application-prod.properties can control it. It is printed by SpringApplication.printBanner() through SpringApplicationBannerPrinter, and the built-in default is the SpringBootBanner class. After printing, the banner is registered as a singleton bean named springBootBanner.
Java
// Default Spring Boot banner output at startup:
//
//   .   ____          _            __ _ _
//  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
// ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
//  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
//   '  |____| .__|_| |_|_| |_\__, | / / / /
//  =========|_|==============|___/=/_/_/_/
//
//  :: Spring Boot ::                (v3.5.0)      <- your version
//
// Where it happens:
//   SpringApplication.run() -> printBanner(environment)
//   SpringApplicationBannerPrinter.print(...)
//   fallback when nothing else is configured: SpringBootBanner

Custom Text Banner — banner.txt

Replace the default banner by creating a banner.txt file in src/main/resources. Spring Boot detects it automatically and prints it instead of the Spring logo. The file is plain text: everything in it is printed as-is, including comment-looking lines, so do not add // or # comment lines to the file itself. Generate the art with any ASCII art generator (search for "text to ASCII art"), paste it into the file, and add the variables you need. Save the file as UTF-8. If you use box-drawing or block characters, make sure your terminal and logs can display them, and set spring.banner.charset if the file uses another encoding.
Text
  __  __        _
 |  \/  |_  _  /_\  _ __ _ __
 | |\/| | || |/ _ \| '_ \ '_ \
 |_|  |_|\_, /_/ \_\ .__/ .__/
         |__/      |_|  |_|

 ${spring.application.name:My Application}
 Version     : ${application.formatted-version}
 Spring Boot : ${spring-boot.formatted-version}
 Java        : ${java.version}
 Profile(s)  : ${spring.profiles.active:default}

Banner Variables and How They Resolve

Placeholders in banner.txt are resolved against the Spring Environment, so system properties, environment variables and application properties all work, in addition to the banner-specific variables below. Use the default syntax ${name:default} for anything that may be missing: an unresolved placeholder is not an error, it is printed literally, which looks like a bug. Banner-specific variables: - ${application.version}: Implementation-Version from MANIFEST.MF, for example 1.0.0 - ${application.formatted-version}: the same, formatted as (v1.0.0) - ${application.title}: Implementation-Title from MANIFEST.MF - ${spring-boot.version}: the Spring Boot version, for example 3.5.0 - ${spring-boot.formatted-version}: formatted as (v3.5.0) - ${AnsiColor.NAME}, ${AnsiBackground.NAME}, ${AnsiStyle.NAME}: ANSI escape sequences (see the next section) Gotchas: - The manifest-based variables are only available when the application runs from a packaged jar. From an IDE or mvn spring-boot:run there is no manifest, and the value is blank. - ${spring.profiles.active} exists only when the profile is set through a property or environment variable. Profiles activated in code (setAdditionalProfiles) do not appear; use a programmatic Banner and environment.getActiveProfiles() for that. - Any property works: ${spring.application.name:MyApp}, ${server.port:8080}, ${java.version}, ${os.name}. - Build-time resource filtering can eat your placeholders. If you enable Maven filtering for banner.txt with the default ${...} delimiter, Maven replaces them at build time. Spring Boot's starter parent filters only application*.properties/yml files, using @...@ as the delimiter, so keep banner.txt out of the filtered resources, and note that @ characters inside ASCII art would be mangled if you filter it with that delimiter.
application.properties
# Show the effect of defaults — banner.txt:
#   Version : ${application.version}              -> "1.0.0" from a jar, blank from the IDE
#   Profile : ${spring.profiles.active:default}   -> "default" when no profile property is set
#   Port    : ${server.port:8080}                 -> value of server.port, or 8080

# Unresolved placeholders are printed literally:
#   Region : ${deploy.region}                     -> prints: ${deploy.region}
#   Region : ${deploy.region:unknown}             -> prints: unknown

ASCII Art, Colors and Styles

ANSI placeholders turn colors and text styles on and off in the banner. Always reset to default after a colored block, otherwise the following log lines stay colored. Available names: - ${AnsiColor.X} with X = BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, the BRIGHT_ variant of each (for example BRIGHT_CYAN), and DEFAULT - ${AnsiBackground.X} with the same color names - ${AnsiStyle.X} with X = NORMAL, BOLD, FAINT, ITALIC, UNDERLINE ANSI codes only render in terminals that support them. When ANSI output is disabled (spring.output.ansi.enabled=never, or detect finds no capable terminal), Spring Boot strips the placeholders, so the banner prints as plain text. In CI logs and log files, set spring.output.ansi.enabled=never to avoid stray escape sequences. Block and box-drawing characters need UTF-8. Spring Boot reads banner.txt as UTF-8 by default (spring.banner.charset), but the terminal or the Windows console must also use UTF-8, otherwise you see question marks. On modern JDKs you can set stdout.encoding=UTF-8 (JDK 19+) or file.encoding.
Text
${AnsiColor.BRIGHT_CYAN}
 ███╗   ███╗██╗   ██╗ █████╗ ██████╗ ██████╗
 ████╗ ████║╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
 ██╔████╔██║ ╚████╔╝ ███████║██████╔╝██████╔╝
 ██║╚██╔╝██║  ╚██╔╝  ██╔══██║██╔═══╝ ██╔═══╝
 ██║ ╚═╝ ██║   ██║   ██║  ██║██║     ██║
 ╚═╝     ╚═╝   ╚═╝   ╚═╝  ╚═╝╚═╝     ╚═╝
${AnsiColor.DEFAULT}
${AnsiColor.BRIGHT_WHITE} :: My Application ::${AnsiColor.DEFAULT}
${AnsiStyle.BOLD}   Version     :${AnsiStyle.NORMAL} ${application.formatted-version}
${AnsiStyle.BOLD}   Spring Boot :${AnsiStyle.NORMAL} ${spring-boot.formatted-version}
${AnsiStyle.BOLD}   Java        :${AnsiStyle.NORMAL} ${java.version}
${AnsiStyle.BOLD}   Profile(s)  :${AnsiStyle.NORMAL} ${spring.profiles.active:default}

Image Banner — banner.gif / banner.jpg / banner.png

Spring Boot can convert an image to ASCII art and print it as the banner. Put a file named banner.gif, banner.jpg or banner.png in src/main/resources, or point to it with spring.banner.image.location. If several exist, the lookup order is gif, then jpg, then png. Important: image and text banners are not alternatives. If both an image and a banner.txt exist, both are printed, the image first and the text below it. To get only one of them, remove the other file or point its location property to something that does not exist. Image banners are printed using ANSI colors when the terminal supports them, and a GIF is printed frame by frame. Keep the source image small and high-contrast, and test in the terminal your team uses. Image banners are much larger in log output than text banners, so they suit development, not production logs.
application.properties
# application.properties — image banner settings
spring.banner.image.location=classpath:banner.png
spring.banner.image.width=76        # width in characters (default 76)
spring.banner.image.height=0        # height is derived from the width and the aspect ratio by default
spring.banner.image.margin=2        # left margin in characters (default 2)
spring.banner.image.invert=false    # true for dark terminal themes
spring.banner.image.bitdepth=4      # 4 or 8 (default 4)
spring.banner.image.pixelmode=text  # text or block

# Both a text banner and an image banner exist -> BOTH are printed (image first):
spring.banner.location=classpath:banner.txt
spring.banner.image.location=classpath:logo.png

# Best practices:
# - simple, high-contrast logos work best
# - keep the source image small (64x64 to 128x128 pixels)
# - use it in dev profiles only; use a short text banner in production

Controlling the Banner: Mode, Colors and Location

Banner behavior is controlled with a few properties: whether it is printed, where it goes, whether ANSI is used, and where the files are. spring.main.banner-mode accepts console (print to System.out, the default), log (send it to the configured logger at startup) and off (print nothing). Because the environment is prepared before the banner is printed, profile-specific files such as application-prod.properties work for these settings. There is more than one way to set the mode, which is useful when you cannot change the jar: a property in application.properties, a command-line argument (--spring.main.banner-mode=off), a JVM argument (-Dspring.main.banner-mode=off), an environment variable (SPRING_MAIN_BANNER_MODE=off), or code (SpringApplication.setBannerMode or SpringApplicationBuilder.bannerMode).
application.properties
# ── Banner mode ──────────────────────────────────────────────────────
spring.main.banner-mode=console   # console (default) | log | off

# ── ANSI color support ────────────────────────────────────────────────
spring.output.ansi.enabled=detect # detect (default) | always | never

# ── Banner location and encoding ──────────────────────────────────────
spring.banner.location=classpath:banner.txt            # default
# spring.banner.location=classpath:banners/my-banner.txt
# spring.banner.location=file:./banner.txt              # from the filesystem
spring.banner.charset=UTF-8                             # default

# ── Profile-specific control ──────────────────────────────────────────
# application-dev.properties:
#   spring.main.banner-mode=console
#   spring.output.ansi.enabled=always
# application-prod.properties:
#   spring.main.banner-mode=log       # banner appears in the startup log
#   spring.output.ansi.enabled=never  # no escape codes in log files
# src/test/resources/application.properties:
#   spring.main.banner-mode=off

# ── Other ways to switch it off ───────────────────────────────────────
# java -jar app.jar --spring.main.banner-mode=off
# java -Dspring.main.banner-mode=off -jar app.jar
# export SPRING_MAIN_BANNER_MODE=off
#
# In code:
#   SpringApplication app = new SpringApplication(Application.class);
#   app.setBannerMode(Banner.Mode.OFF);
#   // or: new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF).run(args);
#
# In a test:
#   @SpringBootTest(properties = "spring.main.banner-mode=off")

Programmatic Banner Customization

For dynamic content, such as the active profiles, the PID, the host name or a build timestamp, implement the Banner interface and register it with SpringApplication.setBanner(). Important caveat: setBanner() registers a fallback banner. Spring Boot prints your Banner only when it finds no banner.txt and no image banner. If a banner.txt (or banner image) exists on the classpath, the file wins and your class is silently ignored; if you configure both, only the files are printed. Either remove the files from that application, or set the banner mode to OFF and print the banner yourself. To reuse the placeholder support of banner.txt from code, wrap the file in a ResourceBanner. To combine your own banner with the standard one, call both from your printBanner method.
Java
public class ApplicationBanner implements Banner {

    @Override
    public void printBanner(Environment environment,
                            Class<?> sourceClass,
                            PrintStream out) {

        String appName = environment.getProperty("spring.application.name", "MyApp");
        String version = environment.getProperty("app.version", "unknown");
        String[] active = environment.getActiveProfiles();   // works for profiles set in code too
        String profiles = active.length > 0 ? String.join(", ", active) : "default";

        out.println();
        out.println("  ======================================");
        out.printf ("  %s%n", appName);
        out.println("  ======================================");
        out.printf ("  Version     : %s%n", version);
        out.printf ("  Profile(s)  : %s%n", profiles);
        out.printf ("  Java        : %s%n", System.getProperty("java.version"));
        out.printf ("  PID         : %d%n", ProcessHandle.current().pid());
        out.printf ("  Started at  : %s%n", LocalDateTime.now());
        out.println();
    }
}

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setBanner(new ApplicationBanner());   // FALLBACK: used only if no banner.txt / image exists
        app.run(args);
    }
}

// ── Make your Banner always win: print it yourself and turn the standard one off ──
//   app.setBannerMode(Banner.Mode.OFF);
//   new ApplicationBanner().printBanner(environment, Application.class, System.out);
//   (for example from an ApplicationEnvironmentPreparedEvent listener)

// ── Reuse banner.txt placeholders from code: ──────────────────────────
//   app.setBanner(new ResourceBanner(new ClassPathResource("my-banner.txt")));

Showing the Application Version in the Banner

There are two reliable ways to put the application version in the banner. 1. Jar manifest. ${application.version} and ${application.title} read Implementation-Version and Implementation-Title from META-INF/MANIFEST.MF. With Maven and spring-boot-starter-parent, the jar plugin is configured to write these entries (addDefaultImplementationEntries), so they are there in the packaged jar. Without the starter parent, configure the jar plugin yourself. With Gradle, set the attributes on the bootJar manifest. Remember that the value is blank when you run from an IDE or from the classes directory. 2. A property. Filter the version into application.properties at build time and reference it from the banner. This also works from the IDE. With the Maven starter parent, @...@ placeholders in application.properties are filtered automatically. Note that Spring Boot's build-info support (the buildInfo() Gradle task or the build-info goal of the Maven plugin) creates META-INF/build-info.properties and a BuildProperties bean, which you can inject into your code or expose through the Actuator info endpoint. Those values are not available as banner variables, so ${build.version} does not work in banner.txt.
application.properties
# ── Option 1: manifest ───────────────────────────────────────────────
# Maven (with spring-boot-starter-parent this is already configured):
#   <plugin>
#     <groupId>org.apache.maven.plugins</groupId>
#     <artifactId>maven-jar-plugin</artifactId>
#     <configuration>
#       <archive><manifest>
#         <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
#       </manifest></archive>
#     </configuration>
#   </plugin>
#
# Gradle (build.gradle):
#   tasks.named('bootJar') {
#       manifest {
#           attributes 'Implementation-Title': project.name,
#                      'Implementation-Version': project.version
#       }
#   }
#
# Verify the manifest of the built jar:
#   unzip -p target/myapp.jar META-INF/MANIFEST.MF | grep Implementation

# ── Option 2: a property filled in at build time (Maven starter parent) ─
# application.properties:
app.version=@project.version@

# banner.txt:
#   Version : ${app.version}

Banner Best Practices

Development: keep the banner. Put the service name, version and profile in it, so you can tell at a glance which service is running in which terminal. Use ANSI colors if your team's terminals support them. Production: use a short text banner with no ANSI codes, and prefer log mode if you want the version recorded in the startup logs. Set spring.output.ansi.enabled=never. Avoid image banners, since they add dozens of lines to every startup. If you run structured JSON logging, consider turning the banner off, because a multi-line banner in a JSON stream is noise for log parsers. Tests: turn the banner off to reduce noise, either in src/test/resources/application.properties or with @SpringBootTest(properties = "spring.main.banner-mode=off"). CI/CD: set SPRING_OUTPUT_ANSI_ENABLED=never so logs have no escape sequences. Containers and Kubernetes: with many short-lived pods, the banner adds lines to every start. Use banner-mode=log or off, and put the version in a structured startup log line or the Actuator info endpoint instead. Do not put secrets, passwords or internal URLs in the banner, since it can end up in shared logs.

Common Banner Problems

1. Custom banner.txt is ignored. The file is not at the root of the classpath (it must be at src/main/resources/banner.txt, not in a subfolder, unless you set spring.banner.location), the file name has a typo, spring.main.banner-mode is off, or the build did not copy resources (run a clean build and check the jar). 2. ${application.version} is blank. You run from an IDE or the classes directory, or the manifest has no Implementation-Version. Run from the jar or use a property-based version. 3. Placeholders show up literally, for example ${deploy.region}. The property is not defined. Use a default value: ${deploy.region:unknown}. 4. Colors show as strange characters like [36m. The console or log viewer does not interpret ANSI. Set spring.output.ansi.enabled=never. 5. Question marks instead of block characters. The file or the console is not UTF-8. Save banner.txt as UTF-8, keep spring.banner.charset=UTF-8, and use a UTF-8 console (on Windows, a UTF-8 code page or Windows Terminal). 6. setBanner() has no effect. It is only a fallback; an existing banner.txt or image wins. 7. Both an image and a text banner appear. That is intended: image first, text second. Remove one. 8. Maven filtering altered banner.txt. Resource filtering replaced placeholders or @ characters. Exclude banner.txt from filtering. 9. The banner shows twice in tests or logs. A log-mode banner plus a console-mode banner, or a test context started twice. Check spring.main.banner-mode and the number of application contexts. 10. The banner shows the wrong Spring Boot version. ${spring-boot.version} reflects the Spring Boot version on the classpath at runtime, so a mismatch usually means a dependency override or a fat jar built against another version.

Frequently Asked Questions

How do I change the Spring Boot banner? Create src/main/resources/banner.txt with your own text or ASCII art. Spring Boot picks it up automatically. How do I disable the banner? Set spring.main.banner-mode=off in application.properties, pass --spring.main.banner-mode=off, set SPRING_MAIN_BANNER_MODE=off, or call setBannerMode(Banner.Mode.OFF) in code. How do I show the application version in the banner? Use ${application.version} (or ${application.formatted-version}), which reads the jar manifest, or filter the version into a property at build time and reference it. The manifest value is blank when running from an IDE. Can I use colors in the banner? Yes, with ${AnsiColor.NAME}, ${AnsiBackground.NAME} and ${AnsiStyle.NAME}. Reset with ${AnsiColor.DEFAULT}. Colors need an ANSI-capable terminal. Can I use an image as the banner? Yes. Add banner.gif, banner.jpg or banner.png. It is converted to ASCII art and printed above any text banner. What is spring.main.banner-mode=log? It sends the banner to the application logger instead of System.out, so it goes wherever your logs go, including log files. Where does the banner go in tests? @SpringBootTest prints it like a normal start. Disable it with spring.main.banner-mode=off in src/test/resources/application.properties. Why is my setBanner() banner not shown? setBanner() sets a fallback that is used only if no banner.txt or banner image exists. Can I change the banner file location? Yes. Use spring.banner.location (for example classpath:banners/my-banner.txt or file:./banner.txt) and spring.banner.image.location. Can the banner show the active profile? Use ${spring.profiles.active:default} if the profile is set through a property or environment variable. For profiles set in code, use a custom Banner class and environment.getActiveProfiles(). Is the banner a security risk? Not by itself, but do not put secrets or internal details in it, and note that the Spring Boot version it prints can help an attacker in logs that are exposed publicly.

Key Takeaways

- banner.txt in src/main/resources replaces the default banner. It is plain text, so do not put comments in it. - Placeholders resolve against the Environment. Give optional ones a default, such as ${spring.profiles.active:default}. - ${application.version} comes from the jar manifest and is blank in the IDE; a build-time property is an alternative. - Image and text banners are both printed if both exist, image first. - spring.main.banner-mode: console, log or off. spring.output.ansi.enabled: detect, always or never. - setBanner() is only a fallback, and does nothing if banner.txt or an image exists. - Keep production banners short and ANSI-free, and switch the banner off in tests. - Related topics: SpringApplication, Application Properties, Profiles, Logging Configuration, Actuator Info Endpoint.