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

Stella981
• 阅读 487

  前言

  我们注意到springboot项目启动时,控制台会打印自带的banner,然后对于部分IT骚年来说,太单调太普通太一般了;所以,是时候表演真正的技术了

   项目结构

  我们只需要在springboot项目的resources文件夹下面创建一个banner.txt文件,springboot启动的时候会去加载这个文件,项目结构:

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

   banner.txt

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

  http://patorjk.com/software/taag

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

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

  banner.txt的内容:

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

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

  banner.txt配置

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

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

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

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

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

  spring对banner的配置,来自springboot参考手册,Common application properties:https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#common-application-properties

# 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.

  效果 

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

  结束语

  秀儿,是你吗?

  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

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

  代码开源

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

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

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

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
待兔 待兔
2个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Easter79 Easter79
2年前
SpringBoot系列——花里胡哨的banner.txt
  前言  我们注意到springboot项目启动时,控制台会打印自带的banner,然后对于部分IT骚年来说,太单调太普通太一般了;所以,是时候表演真正的技术了   项目结构  我们只需要在springboot项目的resources文件夹下面创建一个banner.txt文件,springboot启动的时候会去加载这个
Easter79 Easter79
2年前
SpringBoot自定义序列化的使用方式
场景及需求:项目接入了SpringBoot开发,现在需求是服务端接口返回的字段如果为空,那么自动转为空字符串。例如:\    {        "id":1,        "name":null    },    {        "id":2,        "name":"x
Easter79 Easter79
2年前
Twitter的分布式自增ID算法snowflake (Java版)
概述分布式系统中,有一些需要使用全局唯一ID的场景,这种时候为了防止ID冲突可以使用36位的UUID,但是UUID有一些缺点,首先他相对比较长,另外UUID一般是无序的。有些时候我们希望能使用一种简单一些的ID,并且希望ID能够按照时间有序生成。而twitter的snowflake解决了这种需求,最初Twitter把存储系统从MySQL迁移
Stella981 Stella981
2年前
SpringBoot自定义序列化的使用方式
场景及需求:项目接入了SpringBoot开发,现在需求是服务端接口返回的字段如果为空,那么自动转为空字符串。例如:\    {        "id":1,        "name":null    },    {        "id":2,        "name":"x
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
8个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这