spring boot的 banner

第一个想到的是直接在resource下放一个banner.txt

当然需要生成txt的网站,有更具字体生成,有选图片 :

Text to ASCII Art Generator (TAAG)

Spring Boot banner在线生成工具,制作下载banner.txt,修改替换banner.txt文字实现自定义,个性化启动banner-bootschool.net

关于中文文字的ascii艺术字,自定义Spring Boot 中文文字 banner下载,各种有意思的banner、ascii图案,还有中文文字banner,作为Spring Boot和终端命令行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}            //
                        //                                                                                  //

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值