gpt4 book ai didi

java - 如何在标准输出中禁用 Spring Boot Logo ?

转载 作者:IT老高 更新时间:2023-10-28 13:50:49 24 4
gpt4 key购买 nike

有没有办法禁用可爱但非常明显的ASCII Spring boot logo:

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

...每次运行 Spring Boot 应用程序时都在 STDOUT 中转储?

我在我的 logback.xml 中将所有日志记录切换为 ERROR,但什么也没做:

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

编辑:在文档中它不称为“ Logo ”。搜索友好字词是“横幅”。

最佳答案

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

编辑在较新版本的 spring boot(当前是 1.3.3)中,这样做的方法是:

1) 应用程序.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);
}

Docs

编辑:

要使用环境变量更改它,请使用带有下划线而不是点的属性。试试:

SPRING_MAIN_BANNER-MODE=关闭

docs用于外部化配置。

关于java - 如何在标准输出中禁用 Spring Boot Logo ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26585959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com