如何禁用标准输出弹簧启动标志?

有没有一种方法来禁用可爱的,但非常明显的ASCII春季启动标志:

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

每当你运行一个春季启动应用程序时,被倾销到STDOUT?

我在我的logback.xml中将所有日志logging切换到ERROR,但是没有做任何事情:

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

编辑:这不是在文档中称为“标志”。 search友好的术语是一个“旗帜”。

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); 

编辑在新版本的弹簧启动(当前是1.3.3)的方式是:

1)application.properties

spring.main.banner-mode=off

2)application.yml

 spring: main: banner-mode: "off" 

3)主要方法

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

文件

编辑:

要改变这和环境variables使用下划线而不是点的属性。 尝试:

SPRING_MAIN_BANNER-MODE =关

请参阅外部configuration的文档 。

另一个select是将banner.txt文件中的自定义横幅添加到您的类path,这将更改为您的自定义横幅。

  1. 在类path中创build一个文件banner.txt (即: src / main / resources
  2. 编辑您的自定义横幅
  3. 运行应用程序

这在Spring Boot 1.3中稍有改变。 该物业现在是:

 spring.main.banner_mode=off 

在代码中,现在是:

 springApplication.setBannerMode(Banner.Mode.OFF); 

或使用build造者:

 new SpringApplicationBuilder() .bannerMode(Banner.Mode.OFF) 

您可以在application.properties设置spring.main.show_banner=false ,如http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html中所述; 。

如果你使用Spring Boot 1.3和application.yml(不属性),那么你需要引用'OFF'即

 spring: main: banner_mode: 'OFF' 

在src / main / resources下创build一个文件“application.yml”,并粘贴下面的代码。这样做就可以了

spring: main: banner-mode: "off"

所有容易调整弹簧引导application.properties可以在这里find

祝你好运!