Spring Boot定制启动图案
2018-01-22 09:12
288 查看
启动图案
Spring Boot在启动的时候会显示一个默认的Spring的图案,对应的类为SpringBootBanner。. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.6.RELEASE)
图案输出有以下几种模式,默认是CONSOLE的,即只打印到控制台,也可以输出到日志文件。
enum Mode { /** * Disable printing of the banner. */ OFF, /** * Print the banner to System.out. */ CONSOLE, /** * Print the banner to the log file. */ LOG }
关闭图案
@SpringBootApplication public class Application { public static void main(String[] args) { new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF) .run(args); } }
定制图案
很简单,只要在classpath目录下创建banner.txt即可,把图案放入该文件就行,这是Spring Boot默认的图案位置,Spring Boot会自动加载该文件显示图案。生成图案的网站:http://patorjk.com
也可以使用图片,更详细的可以研究Banner接口及其子类,不过这也没什么卵用,有兴趣的可以深入了解下。
当然也支持通过application配置文件来定制图案。
# BANNER banner.charset=UTF-8 # Banner file encoding. banner.location=classpath:banner.txt # Banner file location. banner.image.location=classpath:banner.gif # Banner image file location (jpg/png can also be used). banner.image.width= # Width of the banner image in chars (default 76) banner.image.height= # Height of the banner image in chars (default based on image height) banner.image.margin= # Left hand image margin in chars (default 2) banner.image.invert= # If images should be inverted for dark terminal themes (default false)
推荐阅读
干货:2TB架构师四阶段视频教程面经:史上最全Java多线程面试题及答案
面经:史上最全阿里高级Java面试题
面经:史上最全Spring面试题
教程:最全Spring Boot全套视频教程
书籍:进阶Java架构师必看的15本书
工具:推荐一款在线创作流程图、思维导图软件
分享Java干货,高并发编程,热门技术教程,微服务及分布式技术,架构设计,区块链技术,人工智能,大数据,Java面试题,以及前沿热门资讯等。
相关文章推荐
- 00. 定制springboot启动图案
- 修改定制SpringBoot的启动banner图案
- 修改spring Boot启动时的默认图案Banner
- spring boot 默认启动图案
- SpringBoot小彩蛋,自定义项目启动时图案
- Spring-Boot自定义启动图案
- Spring Boot启动banner定制的步骤详解
- spring-boot整合rabbitmq启动报错no queue 'dev_pms2invoi_queue' in vhost '/'
- win10下nginx部署spring boot项目的配置与启动
- Spring Boot启动流程详解(一)
- springBoot项目打jar包发布时启动包内置tomcat无法启动错误分析
- springboot之启动原理解析
- 如何在IDEA启动多个Spring Boot工程实例
- Spring boot 启动错误处理
- springboot启动mybatis
- Spring Boot 启动加载数据 CommandLineRunner
- 惠普定制ipc101启动安装f9进入boot
- SpringBoot 打包为war包启动时导入外部配置文件
- Spring Boot启动过程(五)之Springboot内嵌Tomcat对象的start教程详解
- Spring boot 常见的启动失败原因