前言

  我们注意到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的更多相关文章

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

    Creating ASCII Text Banners from the Linux Command Line In Ubuntu, Debian, Linux Mint etc. $ sudo ap ...

  2. Springboot 系列(八)动态Banner与图片转字符图案的手动实现

    使用过 Springboot 的对上面这个图案肯定不会陌生,Springboot 启动的同时会打印上面的图案,并带有版本号.查看官方文档可以找到关于 banner 的描述 The banner tha ...

  3. 32. Springboot 系列(八)动态Banner与图片转字符图案的手动实现

    使用过 Springboot 的对上面这个图案肯定不会陌生,Springboot 启动的同时会打印上面的图案,并带有版本号.查看官方文档可以找到关于 banner 的描述 The banner tha ...

  4. 【Java】SpringBoot 佛祖保佑banner.txt

    最新写代码有点多,拜拜佛祖,代码不出bug. 在springboot项目的resources文件夹下面创建一个banner.txt文件,springboot启动的时候默认会加载这个文件 ${AnsiC ...

  5. (28)SpringBoot启动时的Banner设置【从零开始学Spring Boot】

    对于使用过Spring Boot的开发者来说,程序启动的时候输出的由字符组成的Spring符号并不陌生.这个是Spring Boot为自己设计的Banner: 1.    .   ____       ...

  6. springboot系列之02-需要了解的宏观知识点

    未经允许,不得转载 原作者:字母哥博客 本文完整系列出自:springboot深入浅出系列 一.Spring Boot . Spring MVC .Spring对比 首先你需要明白一件事情:Sprin ...

  7. SpringBoot系列(二)入门知识

    SpringBoot系列(二)入门知识 往期推荐 SpringBoot系列(一)idea新建springboot项目 引言 本来新建springboot项目应该放在入门知识这一章的,但是由于新建spr ...

  8. 【springBoot】之定制Banner

    springboot启动时控制台打印图案如下: 1.假如我们不想看到这个图案 public static void main(String[] args) { SpringApplication ap ...

  9. springboot 修改和设置 banner

    springboot 修改和设置 banner 先上图 修改步骤 1.在src/main/resources下新建一个banner.txt文档 2.通过http://patorjk.com/softw ...

随机推荐

  1. CentOS开启telnet服务

    原文地址:https://blog.csdn.net/zhujiangm/article/details/4540778 服务器:CentOS-5.1(192.168.1.87)客户机:FC6(192 ...

  2. Shell条件测试和流程控制-4

  3. ie页面数据导入共享版

    为了解决自动输入号码的正确率,原来的版本一直采用鼠标检测的方法.但是这个方法在其他ie平台的使用不太方便.于是直接检测ie的方法.现在的这个版本完全不需要鼠标的检测.方便而且快速精准可靠. 经过作者的 ...

  4. Linux下使用openVPN连接到某个内网

    推荐一个网站(比较全的介绍关于openvpn的客户端与服务端的配置) 点击我 此处我介绍我配置openvpn客户端连接的坑 我的机器为kali linux apt-get install openvp ...

  5. Azure Active Directory document ---reading notes

    微软利用本地活动目录 Windows Server Active Directory 进行身份认证管理方面具有丰富的经验,现在这一优势已延伸基于云平台的Azure Active Directory.可 ...

  6. js怎么实现继承?

    3. js怎么实现继承? 1. 使用原型prototype 这个问题其实之前总结过了……但是面试时候有点忘……主要思想是记得的,但是不会写,还是基础太不牢靠,写的太少了.一开始因为不知道怎么能继承父类 ...

  7. FFmpeg 学习(一):FFmpeg 简介

    一.FFmpeg 介绍 FFmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源计算机程序.采用LGPL或GPL许可证.它提供了录制.转换以及流化音视频的完整解决方案.它包含了非常先 ...

  8. Android 代码混淆配置总结

    一.前言 为何需要混淆呢?简单的说,就是将原本正常的项目文件,对其类,方法,字段,重新命名,a,b,c,d,e,f…之类的字母,达到混淆代码的目的,这样反编译出来,结构乱糟糟的,看了也头大. 另外说明 ...

  9. [转载]PHP中PSR-[0-4]规范

      PHP是世界上最伟大的语言,这一点是毋庸置疑的吧.哈哈哈哈哈哈 .这个霸气的开头不错!(^__^) 但是正是因为伟大,所以用的人也就多了,人一多,再牛逼再伟大的东西,都会产生问题,逐渐就造成了很多 ...

  10. mybatis foreach报错It was either not specified and/or could not be found for the javaType Type handler

    或许是惯性思维,在mybatis使用foreach循环调用的时候,很多时候都是传一个对象,传一个List的情况很少,所以写代码有时候会不注意就用惯性思维方法做了. 今天向sql传参,传了一个List作 ...