Spring Boot 自定义Banner
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.2.RELEASE)
1.关闭Banner
public static void main(String[] args) throws Exception {
SpringApplication springApplication = new SpringApplication(SampleController.class);
springApplication.setBannerMode(Banner.Mode.OFF);
springApplication.run(args);
}
Banner.Mode是个内部枚举,有三个值如下:
enum Mode {
/**
* Disable printing of the banner. 关闭Banner打印输出
*/
OFF,
/**
* Print the banner to System.out. 打印Banner 控制台
*/
CONSOLE,
/**
* Print the banner to the log file. 打印banner 到日志文件
*/
LOG
}
2.更改Banner
| Variable | Description |
| ${application.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). |
| ${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) |
| ${spring-boot.version} | The Spring Boot version that you are using. For example 1.4.2.RELEASE. |
| ${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.2.RELEASE). |
| ${Ansi.NAME} (or ${AnsiColor.NAME}, ${AnsiBackground.NAME}, ${AnsiStyle.NAME}) | Where NAME is the name of an ANSI escape code. See AnsiPropertySource for details. |
| ${application.title} | The title of your application as declared in MANIFEST.MF. For example Implementation-Title: MyApp is printed as MyApp. |
(2)或者通过springApplication.setBanner(banner);方法,实现Banner接口也一样。
751



被折叠的 条评论
为什么被折叠?



