Spring Boot Disable Startup Banner

To disable the spring boot banner logo from the console or log files, we can make changes in 3 possible ways i.e. programmatically, properties, or startup arguments. 1. Disable Banner Programmatically Set banner mode in the program using setBannerMode(Banner.Mode.OFF) method call which starts the application. 2. Disable Banner …

Spring boot banner

To disable the spring boot banner logo from the console or log files, we can make changes in 3 possible ways i.e. programmatically, properties, or startup arguments.

Banner mode can be set in 3 possible ways:

  1. OFF – Disable printing of the banner in console and log files.
  2. CONSOLE – Print the banner only to console.
  3. LOG – Print the banner only to the log file.

1. Disable Banner Programmatically

Set banner mode in the program using setBannerMode(Banner.Mode.OFF) method call which starts the application.

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

@SpringBootApplication
public class Application {
    public static void main(String[] args) {

    	SpringApplication app = new SpringApplication(Application.class);
        app.setBannerMode(Banner.Mode.OFF);
        app.run(args);
    }
}

2. Disable Banner using Properties

Use property key spring.main.banner-mode to set the banner mode using properties configuration.

spring.main.banner-mode=off
spring:
  main:
    banner-mode:"off"

3. Disable Banner using Startup Arguments

Pass the property key spring.main.banner-mode as a startup argument and set the mode there.

workspace> java -Dspring.main.banner-mode=off -jar spring-boot-simple-1.0.jar

Drop me your questions in the comments related to disabling the spring boot logo banner.

Happy Learning !!

References: Spring boot docs

Weekly Newsletter

Stay Up-to-Date with Our Weekly Updates. Right into Your Inbox.

Comments

Subscribe
Notify of
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.