Disable Spring Boot Project Banner

1. Overview

When we start a Spring Boot application, it displays a similar banner message in the console:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

While it doesn’t cause any disruption, we can disable it, if required. In this article, we’ll review various options to disable the Spring Boot banner.

2. Using Properties

Similar to all other Spring Boot properties, we can disable the banner in our application properties:

spring.main.banner-mode=off

Now, let’s disable the banner using yml properties:

spring:
  main:
    banner-mode: "off"

3. Disabling In Program

Now, let’s see how to disable the banner programmatically. Let’s use setBannerMode method on SpringApplication class to turn off the banner:

public static void main(String[] args) {
    SpringApplication application = new SpringApplication(DisableBannerProgramApplication.class);
    application.setBannerMode(Mode.OFF);
    application.run(args);
}

4. Disabling during Startup

We can disable the banner without modifying the application properties or the code.

Let’s disable the banner passing the banner mode as a property:

java -Dspring.main.banner-mode=off -jar SpringBootDemo.jar

Now, let’s disable the banner by passing the banner mode as an argument to the Spring Boot application:

java -jar SpringBootDemo.jar --spring.main.banner-mode=OFF

5. Conclusion

In this article, we discussed various ways to turn off the Spring Boot banner. As always, the examples in this code are available on GitHub.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s