Customize Spring Boot Startup Banner with ASCII Art and ANSI Colors

This guide shows how to replace Spring Boot's default console banner by creating a custom banner.txt with ASCII graphics, using built‑in placeholders for version, port, profile and date, adding ANSI color codes, and optionally disabling the default banner to print a fully customized startup message from Java code.

Top Architect
Top Architect
Top Architect
Customize Spring Boot Startup Banner with ASCII Art and ANSI Colors

What is Spring Boot banner.txt

When a Spring Boot application starts it prints a banner whose content is read from resources/banner.txt. By editing this file you can display any ASCII art, version information, or custom messages.

Creating or modifying banner.txt

Place the file under src/main/resources in your project. Example content using Spring Boot placeholders:

===========================================
==         AbsWeb 启动成功! 🚀         ==
==         端口:${server.port}          ==
==         环境:${spring.profiles.active} ==
==         时间:${date}                ==
===========================================

Supported placeholders: ${application.version} – version from the JAR’s

MANIFEST.MF
${application.formatted-version}

– formatted version string ${spring-boot.version} – Spring Boot version ${server.port} – HTTP port ${spring.profiles.active} – active profile name ${date} – current date/time ${AnsiColor.NAME} – console colour (e.g., GREEN, RED)

Adding colour and style (optional)

Spring Boot supports ANSI escape codes. Wrap the banner with a colour code and reset it afterwards:

${AnsiColor.BRIGHT_CYAN}
===========================================
==         AbsWeb 启动成功! 🚀         ==
==         端口:${server.port}          ==
==         环境:${spring.profiles.active} ==
==         时间:${date}                ==
===========================================
${AnsiColor.DEFAULT}

The result appears in cyan on terminals that support ANSI colours.

Disabling the default banner

To generate the banner programmatically, turn off the built‑in banner:

# application.yml
spring:
  main:
    banner-mode: "off"

or

# application.properties
spring.main.banner-mode=off

Printing a custom banner from Java

Define ANSI colour constants and a printBanner() method in the main class. Example:

public class AbsWebApplication {
    private static final String RESET = "\u001B[0m";
    private static final String CYAN  = "\u001B[36m";
    private static final String BLUE  = "\u001B[34m";
    private static final String PURPLE = "\u001B[35m";

    public static void main(String[] args) {
        SpringApplication.run(AbsWebApplication.class, args);
        printBanner();
    }

    private static void printBanner() {
        System.out.println();
        System.out.println(CYAN + "╔════════════════════════════════════════════╗" + RESET);
        // ... other lines omitted for brevity ...
        System.out.println(CYAN + "║ Version: v2.6.13  Time: " + java.time.LocalTime.now() + " ║" + RESET);
        System.out.println(CYAN + "╚════════════════════════════════════════════╝" + RESET);
        System.out.println();
    }
}

Running the application prints the coloured banner shown below.

Banner output
Banner output

Online tools for generating ASCII art (optional):

https://patorjk.com/software/taag/

https://ascii.co.uk/art

https://fsymbols.com/generators/carty/

JavaSpring Bootcustomizationascii-artBannerANSI Color
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.