第一个想到的是直接在resource下放一个banner.txt
当然需要生成txt的网站,有更具字体生成,有选图片 :
Text to ASCII Art Generator (TAAG)
Spring Boot banner在线生成工具,制作下载banner.txt,修改替换banner.txt文字实现自定义,个性化启动banner-bootschool.net
当然还可以通过yml配置配置指定路径的图片格式的banner或者txt格式的banner
spring
banner:
charset: UTF-8 # Banner file encoding.
location: classpath:img/banner.txt # Banner file location.
image:
location: classpath:lcsm.gif # Banner image file location (jpg/png can also be used).
width: # Width of the banner image in chars (default 76)
height: # Height of the banner image in chars (default based on image height)
margin: # Left hand image margin in chars (default 2)
invert: # If images should be inverted for dark terminal themes (default false)
这几种配置的优先级 :
spring.banner.location = spring.banner.image.location
> resources下的banner.txt = resources下的banner.png(.jpg/.gif)
> 自建实现类Banner
> springboot默认
如果txt和图片同时有效存在,那么启动服务两个都会输出,先输出图片后输出txt。
可以配置在application.yml 里面添加 spring.output.ansi.enabled: ALWAYS属性,然后就可以添加下面3个属性:
-
AnsiColor: 用来设定字符的颜色
-
AnsiBackground: 用来设定字符的背景色
-
AnsiStyle: 用来控制加粗、斜体、下划线等等。
-
例如:
${AnsiColor.BRIGHT_YELLOW}${AnsiStyle.BOLD}
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'____ //
// .' \| |// `. //
// / \||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\ - /// | | //
// | _| ''---/'' | | //
// \ .-__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.____<|>_/___.' >'"". //
// | | : `- `.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. _ __\ /__ _/ .-` / / //
// ========`-.____`-.________/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// ${AnsiColor.BRIGHT_RED} 佛祖保佑 ${AnsiColor.BRIGHT_YELLOW} //
// ${AnsiColor.BRIGHT_RED} 永不宕机 需求不改 永无BUG 上线顺利 ${AnsiColor.BRIGHT_YELLOW} //
// ${AnsiColor.BRIGHT_RED} 身体健康 头发永驻 告别单身 升职加薪 ${AnsiColor.BRIGHT_YELLOW} //
// //