From 77deae61e3837b72cc1f27155dda4aa5a4d654b9 Mon Sep 17 00:00:00 2001 From: qibaoguang Date: Sun, 8 Feb 2015 21:24:28 +0800 Subject: [PATCH] Update 22.1. Customizing the Banner.md --- .../22.1. Customizing the Banner.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/IV. Spring Boot features/22.1. Customizing the Banner.md b/IV. Spring Boot features/22.1. Customizing the Banner.md index e69de29..bc32419 100644 --- a/IV. Spring Boot features/22.1. Customizing the Banner.md +++ b/IV. Spring Boot features/22.1. Customizing the Banner.md @@ -0,0 +1,14 @@ +###自定义Banner + +通过在classpath下添加一个banner.txt或设置banner.location来指定相应的文件可以改变启动过程中打印的banner。如果这个文件有特殊的编码,你可以使用banner.encoding设置它(默认为UTF-8)。 + +在banner.txt中可以使用如下的变量: + +| 变量 | 描述 | +| ----------- | :--------| +|${application.version}|MANIFEST.MF中声明的应用版本号,例如1.0| +|${application.formatted-version}|MANIFEST.MF中声明的被格式化后的应用版本号(被括号包裹且以v作为前缀),用于显示,例如(v1.0)| +|${spring-boot.version}|正在使用的Spring Boot版本号,例如1.2.2.BUILD-SNAPSHOT| +|${spring-boot.formatted-version}|正在使用的Spring Boot被格式化后的版本号(被括号包裹且以v作为前缀), 用于显示,例如(v1.2.2.BUILD-SNAPSHOT)| + +**注**:如果想以编程的方式产生一个banner,可以使用SpringBootApplication.setBanner(…)方法。使用org.springframework.boot.Banner接口,实现你自己的printBanner()方法。