SpringBoot系列——花里胡哨的banner.txt
前言
我们注意到springboot项目启动时,控制台会打印自带的banner,然后对于部分IT骚年来说,太单调太普通太一般了;所以,是时候表演真正的技术了
项目结构
我们只需要在springboot项目的resources文件夹下面创建一个banner.txt文件,springboot启动的时候会去加载这个文件,项目结构:

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

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- # 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= # 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= # 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
SpringBoot系列——花里胡哨的banner.txt的更多相关文章
- [转]SpringBoot系列——花里胡哨的banner.txt
Creating ASCII Text Banners from the Linux Command Line In Ubuntu, Debian, Linux Mint etc. $ sudo ap ...
- Springboot 系列(八)动态Banner与图片转字符图案的手动实现
使用过 Springboot 的对上面这个图案肯定不会陌生,Springboot 启动的同时会打印上面的图案,并带有版本号.查看官方文档可以找到关于 banner 的描述 The banner tha ...
- 32. Springboot 系列(八)动态Banner与图片转字符图案的手动实现
使用过 Springboot 的对上面这个图案肯定不会陌生,Springboot 启动的同时会打印上面的图案,并带有版本号.查看官方文档可以找到关于 banner 的描述 The banner tha ...
- 【Java】SpringBoot 佛祖保佑banner.txt
最新写代码有点多,拜拜佛祖,代码不出bug. 在springboot项目的resources文件夹下面创建一个banner.txt文件,springboot启动的时候默认会加载这个文件 ${AnsiC ...
- (28)SpringBoot启动时的Banner设置【从零开始学Spring Boot】
对于使用过Spring Boot的开发者来说,程序启动的时候输出的由字符组成的Spring符号并不陌生.这个是Spring Boot为自己设计的Banner: 1. . ____ ...
- springboot系列之02-需要了解的宏观知识点
未经允许,不得转载 原作者:字母哥博客 本文完整系列出自:springboot深入浅出系列 一.Spring Boot . Spring MVC .Spring对比 首先你需要明白一件事情:Sprin ...
- SpringBoot系列(二)入门知识
SpringBoot系列(二)入门知识 往期推荐 SpringBoot系列(一)idea新建springboot项目 引言 本来新建springboot项目应该放在入门知识这一章的,但是由于新建spr ...
- 【springBoot】之定制Banner
springboot启动时控制台打印图案如下: 1.假如我们不想看到这个图案 public static void main(String[] args) { SpringApplication ap ...
- springboot 修改和设置 banner
springboot 修改和设置 banner 先上图 修改步骤 1.在src/main/resources下新建一个banner.txt文档 2.通过http://patorjk.com/softw ...
随机推荐
- 回顾django内容
回顾: 1 HTTP协议:(重点) -请求 -请求首行 -GET /index HTTP/1.1 -请求头部(在django框架中,可以从META中取出来) -key:value------>\ ...
- H3C 路由策略(人为打环)
拓扑如上 任务1:去除环路双ospf 引入 造成路由环路一边是 1 一边是10关掉任意lo口都会生成新的路由表 但是路由表指向不对 变成了一个圆 我们可以采用引入路由打上tag ...
- shell 命令 grep -R 查询包含指定内容的文件
grep -R 举个栗子,在有上百个sql文件的目录下,查找使用 spark引擎 执行的文件. 代码是: grep -R spark ./* 返回的就是包含 spark 的sql文件名.
- PMP:10.项目采购管理
内容中包含 base64string 图片造成字符过多,拒绝显示
- 最小化安装的centos7.5上编译安装git2.19
VMware Workstation已经采用最小化安装CentOS7,显示版本为CentOS7.5,准备采用yum安装git. 采用yum list git发现可安装的GIT软件包版本1.8.3.1, ...
- Delphi XE2 新增 System.Zip 单元, 可用一句话压缩整个文件夹了
内主要就是 TZipFile 类, 最方便使用的是它的类方法: TZipFile.ExtractZipFile() //解压 Zip 文件到指定文件夹 TZipFile.IsValid() //判断指 ...
- SQL Server profile使用技巧
200 ? "200px" : this.width)!important;} --> 介绍 经常会有人问profile工具该怎么使用?有没有方法获取性能差的sql的问题.自 ...
- eclipse运行spark程序时日志颜色为黑色的解决办法
自从开始学习spark计算框架以来,我们老师教的是local模式下用eclipse运行spark程序,然后我在运行spark程序时,发现控制台的日志颜色总是显示为黑色,哇,作为程序猿总有一种强迫症,发 ...
- 漫谈PHP组件、框架、Composer那些事
什么是组件 组件是一组打包的代码,是一系列相关的类.接口和Trait,用于帮助我们解决PHP应用中某个具体问题.例如,你的PHP应用需要收发HTTP请求,可以使用现成的组件如guzzle/guzzle ...
- 第58节:Java中的图形界面编程-GUI
欢迎到我的简书查看我的文集 前言: GUI是图形用户界面,在Java中,图形用户界面我们用GUI表示,而GUI的完整英文为: Graphical User Interface(图形用户接口), 所谓图 ...