栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

spring boot的 banner

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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}            //
                        //                                                                                  //

暑期编程PK赛 得CSDN机械键盘等精美礼品!
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1016376.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号