Spring boot – Disable banner at startup

To disable the spring boot banner logo from 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 program using setBannerMode(Banner.Mode.OFF) method call which starting the application.

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 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 comments related to disabling spring boot logo banner using spring.main.banner-mode.

Happy Learning !!

References: Spring boot docs

Was this post helpful?

Join 7000+ Fellow Programmers

Subscribe to get new post notifications, industry updates, best practices, and much more. Directly into your inbox, for free.

HowToDoInJava

A blog about Java and its related technologies, the best practices, algorithms, interview questions, scripting languages, and Python.