[转]SpringBoot系列——花里胡哨的banner.txt

Creating ASCII Text Banners from the Linux Command Line

In Ubuntu, Debian, Linux Mint etc.

$ sudo apt-get install figlet

In CentOS, RHEL, Fedora etc.

$ yum install figlet

Generate ASCII Text Banners

To use FIGlet with its default settings, simply type:

$ figlet "Shell Hacks"
 ____  _          _ _   _   _            _        
/ ___|| |__   ___| | | | | | | __ _  ___| | _____ 
\___ \| '_ \ / _ \ | | | |_| |/ _` |/ __| |/ / __|
 ___) | | | |  __/ | | |  _  | (_| | (__|   <\__ \
|____/|_| |_|\___|_|_| |_| |_|\__,_|\___|_|\_\___/

List FIGlet Fonts

Print a list of available FIGlet fonts:

$ showfigfonts

To change the font, use the -f option, for example:

$ figlet -f small "Shell Hacks"
___ _ _ _ _ _ _
/ __| |_ ___| | | | || |__ _ __| |__ ___
\__ \ ' \/ -_) | | | __ / _` / _| / /(_-<
|___/_||_\___|_|_| |_||_\__,_\__|_\_\/__/

$ figlet -f digital "Shell Hacks"
+-+-+-+-+-+ +-+-+-+-+-+
|S|h|e|l|l| |H|a|c|k|s|
+-+-+-+-+-+ +-+-+-+-+-+

 

SpringBoot系列——花里胡哨的banner.txt

Spring Boot自定义Banner

banner.txt

  这里有几个定制banner的网站,文字、图片都可以秀起来,怎么秀就看你的骚操作了

  http://patorjk.com/software/taag

  http://www.network-science.de/ascii/

  http://www.degraeve.com/img2txt.php

${AnsiColor.BRIGHT_YELLOW}
////////////////////////////////////////////////////////////////////
//                          _ooOoo_                               //
//                         o8888888o                              //
//                         88" . "88                              //
//                         (| ^_^ |)                              //
//                         O\  =  /O                              //
//                      ____/`---'\____                           //
//                    .'  \\|     |//  `.                         //
//                   /  \\|||  :  |||//  \                        //
//                  /  _||||| -:- |||||-  \                       //
//                  |   | \\\  -  /// |   |                       //
//                  | \_|  ''\---/''  |   |                       //
//                  \  .-\__  `-`  ___/-. /                       //
//                ___`. .'  /--.--\  `. . ___                     //
//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
//      ========`-.____`-.___\_____/___.-`____.-'========         //
//                           `=---='                              //
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
//            佛祖保佑       永不宕机      永无BUG                //
////////////////////////////////////////////////////////////////////

banner.txt配置

https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-banner

  ${AnsiColor.BRIGHT_RED}:设置控制台中输出内容的颜色

  ${application.version}:用来获取MANIFEST.MF文件中的版本号

  ${application.formatted-version}:格式化后的${application.version}版本信息

  ${spring-boot.version}:Spring Boot的版本号

  ${spring-boot.formatted-version}:格式化后的${spring-boot.version}版本信息

# BANNER
spring.banner.charset=UTF-8 # Banner file encoding.
spring.banner.location=classpath:banner.txt # Banner text resource location.
spring.banner.image.location=classpath:banner.gif # Banner image file location (jpg or png can also be used).
spring.banner.image.width=76 # Width of the banner image in chars.
spring.banner.image.height= # Height of the banner image in chars (default based on image height).
spring.banner.image.margin=2 # Left hand image margin in chars.
spring.banner.image.invert=false # Whether images should be inverted for dark terminal themes.

  结束语

  秀儿,是你吗?

  banner默认开启,如果不想让它打印怎么办?

  方法1,在main的run方法设置

/**
 * 启动主类,springboot的入口
 * springboot 默认扫描的类是在启动类的当前包和下级包
 */
@SpringBootApplication
public class SpringbootWebsocketSpringdataJpaApplication {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(SpringbootWebsocketSpringdataJpaApplication.class);
        //Banner.Mode.OFF 关闭
        springApplication.setBannerMode(Banner.Mode.OFF);
        springApplication.run(args);
    }
}

方法2,Edit Configurations --> 勾选Hide banner

 

 

代码开源

  代码已经开源、托管到我的GitHub、码云:

  GitHub:https://github.com/huanzi-qch/springBoot

  码云:https://gitee.com/huanzi-qch/springBoot

 

 

 

posted @ 2020-04-26 09:15  —八戒—  阅读(723)  评论(0编辑  收藏  举报