- 在类路径上添加 banner.txt 默认UTF-8编码,可以通过banner.charset设置编码
或者通过设置属性指定文件位置:banner.location - 也可以指定图片banner.gif,banner.jpg,banner.png
设置属性:banner.image.location
图片会转换成队形的ASCII值打印出来,在banner.txt中可以使用占位符
1. ${application.version}
The version number of your application as declared in MANIFEST.MF
. For exampleImplementation-Version: 1.0
is printed as 1.0
2. ${application.formatted-version}
The version number of your application as declared in MANIFEST.MF
formatted for display (surrounded with brackets and prefixed with v
). For example (v1.0)
3. ${spring-boot.version}
The Spring Boot version that you are using. For example 1.4.0.RELEASE
4. ${spring-boot.formatted-version}
The Spring Boot version that you are using formatted for display (surrounded with brackets and prefixed with v
). For example (v1.4.0.RELEASE)
5. ${Ansi.NAME} (or ${AnsiColor.NAME} ,${AnsiBackground.NAME} , ${AnsiStyle.NAME})
Where NAME is the name of an ANSI escape code.
See AnsiPropertySource for details.
6. ${application.title}
The title of your application as declared in MANIFEST.MF For exampleImplementation-Title: MyApp
is printed as MyApp
通过编码设置 SpringApplication.setBanner(…)
实现org.springframework.boot.Banner接口实现自己的printBanner()方法
使用spring.main.banner-mode
1. console (Print the banner to System.out)
2. log (Print the banner to the log file) --using the configured logger
3. off (Disable printing of the banner)
The printed banner will be registered as a singleton bean under the name springBootBanner