Spring Boot- Disable Spring banner at startup


In your Spring Boot application, you can disable the Spring logo banner at the startup of the application. It can be done by a configuration file (application.properties or application.yaml) as well as programmatically.

Similar Post: How to change default banner text in Spring Boot

1. Configuration file

Set the following below property in the Spring Boot configuration file.

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

When using the application.yaml:

application.yaml
spring:
  main:
    banner-mode: "off"

2. Programmatically

Set the banner mode OFF in the Spring Boot startup class.

SpringBootBannerApp.java
package org.websparrow;

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootBannerApp {

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

When using the SpringApplicationBuilder:

SpringBootBannerApp.java
package org.websparrow;

import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication
public class SpringBootBannerApp {

    public static void main(String[] args) {
        new SpringApplicationBuilder(SpringBootBannerApp.class)
                .bannerMode(Banner.Mode.OFF)
                .run(args);
    }
}

References

  1. How to change default banner text in Spring Boot
  2. Customizing the Banner

Similar Posts

About the Author

Atul Rai
I love sharing my experiments and ideas with everyone by writing articles on the latest technological trends. Read all published posts by Atul Rai.