104

Is there a way to disable the lovely but very visible ASCII Spring boot logo :

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

...dumped in STDOUT every time your run a spring boot app?

I switched all logging to ERROR in my logback.xml, but that did nothing:

<root level="ERROR">
    <appender-ref ref="STDOUT" />
</root>

edit: It's not called a "Logo" in the documentation. The search-friendly-term is a "banner".

Fabien Benoit-Koch
  • 2,784
  • 2
  • 21
  • 33

8 Answers8

161

http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-banner

new SpringApplicationBuilder()
    .showBanner(false)
    .sources(Parent.class)
    .child(Application.class)
    .run(args);

Edit In the newer versions of spring boot(current is 1.3.3) the way to do it is:

1) application.properties

spring.main.banner-mode=off

2) application.yml

spring:
    main:
        banner-mode: "off"

3) main method

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

Docs

Edit:

To change this with and environment variable use the property with underscore instead of dot. Try:

SPRING_MAIN_BANNER-MODE=off

See the docs for externalized config.

Evgeni Dimitrov
  • 21,976
  • 33
  • 120
  • 145
  • 1
    Perfect. I was frantically googling the docs about a "logo", but it's called a banner. Well, thank you ! – Fabien Benoit-Koch Oct 27 '14 at 11:01
  • 6
    It's good though -now all of us searching for logo find this page (; – ASA Jan 12 '16 at 13:45
  • 1
    should be `new SpringApplicationBuilder().bannerMode(Banner.Mode.OFF)` as showBanner is now deprecated – Ondrej Skalicka May 03 '16 at 15:12
  • What's the environment variable equivalent of this? I don't have access to the spring boot app directly (it's a docker image) and so i am setting spring properties via env vars. – batjko Nov 16 '17 at 09:54
  • For an environment variable, I would recommend "SPRING_MAIN_BANNER_MODE", with an underscore instead of a "-", in case the server doesn't support dashes in environment variables. – pconrey Apr 23 '19 at 21:37
30

Another option is adding custom banner in a banner.txt file to your classpath, that will change to your custom banner.

  1. create a file banner.txt in the classpath (i.e: src/main/resources)
  2. Edit you custom banner
  3. Run the application
Leonardo Dias
  • 301
  • 2
  • 5
  • 5
    And if doing this, these tools might be useful: https://www.google.ca/search?q=ascii+text+generator – Raman Feb 22 '16 at 16:53
16

This has changed slightly in Spring Boot 1.3. The property is now:

spring.main.banner_mode=off

In code, it is now:

springApplication.setBannerMode(Banner.Mode.OFF);

or using the builder:

new SpringApplicationBuilder()
.bannerMode(Banner.Mode.OFF)
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211
9

You can set spring.main.show_banner=false in your application.properties as described in http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html.

8

To remove this:

1) spring.main.banner-mode=off

Add above line in the file

application.properties

OR

2) USE this in Main java class

setBannerMode(Banner.Mode.OFF);

OR

3) in-app*.yml file

spring:
        main :
               banner-mode=off

User This Link for More Details

http://mytechnologythought.blogspot.com/2017/07/how-to-remove-spring-boot-banner.html

Vipul Gulhane
  • 761
  • 11
  • 16
  • 1
    shloud be quote or single quote `banner-mode='off'` `banner-mode="off"` – Namo Sep 16 '21 at 05:52
  • please do not use single or double . use Just plain off – Vipul Gulhane Sep 23 '21 at 13:40
  • 1
    You are right, basically. But some old version (eg. 2.1.6.RELEASE) Spring Boot had BindException problem. `Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Boolean] to type [org.springframework.boot.Banner$Mode] at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321) ~[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE]` – Namo Sep 24 '21 at 07:28
  • cool I am glad :) – Vipul Gulhane Sep 25 '21 at 04:16
6

If you are using Spring Boot 1.3 and application.yml (not properties) then you need to quote the 'OFF' i.e.

spring:
  main:
    banner_mode: 'OFF'
Rob
  • 1,037
  • 1
  • 13
  • 20
2

create a file "application.yml" under src/main/resources" and paste the below code.That would do the job

spring:
    main:
        banner-mode: "off"
geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
0

You can use this code to remove banner

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

@SpringBootApplication


public class SpringBootConsoleApplication {

    public static void main(String[] args) throws Exception {

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

    }

}
Usman Yaqoob
  • 535
  • 5
  • 13