How to disable banner in spring boot

Introduction:

When your spring-boot application starts, you should see something similar to the following output (Banner):


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

The banner printed on start up can be changed by adding a banner.txt file to application classpath or by setting the spring.banner.location property to the location of such a file. And Banner is a functional interface, that can be customized.

Ways to disable spring banner:

There are multiple ways to disable spring banner, please find the details below.

From application properties

Add below entry in the application.properties file in the class path.

spring.main.banner-mode=off

From application yml

Add below entry in the application.yml file in the class path.

spring:
    main:
        banner-mode: "off"

From Application Main Method

To turn off the banner, you could write below code in your spring application main class:

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

Please refer spring-boot documentation for more details.

image url
img logo

No comments :

Post a Comment