Spring Boot定制启动图案

启动图案
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)
												
											Spring Boot定制启动图案的更多相关文章
- Spring Boot制作启动图案
		
SpringBoot在启动时会有一个默认图案的,如果不喜欢可以自己制作一个. 在resources的目录下新建banner.txt文件. 制作图案地址:springboot启动图案定制 通过输入字符串 ...
 - Spring Boot 设置启动时banner
		
Spring Boot项目再启动的时候默认会在控制台输出一个字符banner图案,如下图: 我们可以通过下面的方法关闭启动时显示字符banner图案: 关闭banner方法一: public stat ...
 - spring boot无法启动,或者正常启动之后无法访问报404的解决办法
		
以前用spring boot都是用idea的自动创建,或者是用的Jhipster创建的,就没有深究怎么去搭建.但是今天晚上心血来潮,想自己搭一个demo来整合一些技术,于是就花一点时间来手动搭.因为今 ...
 - spring boot容器启动详解
		
目录 一.前言 二.容器启动 三.总结 =======正文分割线====== 一.前言 spring cloud大行其道的当下,如果不了解基本原理那么是很纠结的(看见的都是约定大于配置,但是原理呢?为 ...
 - 让Spring Boot项目启动时可以根据自定义配置决定初始化哪些Bean
		
让Spring Boot项目启动时可以根据自定义配置决定初始化哪些Bean 问题描述 实现思路 思路一 [不符合要求] 思路二[满足要求] 思路三[未试验] 问题描述 目前我工作环境下,后端主要的框架 ...
 - Spring boot自定义启动字符画(banner)
		
spring boot项目启动时会打印spring boot的ANSI字符画,可以进行自定义. 如何自定义 实现方式非常简单,我们只需要在Spring Boot工程的/src/main/resourc ...
 - spring boot 项目启动无任何反应
		
遇到的问题 spring boot项目启动后无任何报错,ps有进程,nohub无日志 定位 更换jar包,问题依然存在,将jar包放到其他服务器,运行正常,排除打包问题 同服务器其他系统运行正常,但停 ...
 - spring boot应用启动原理分析
		
spring boot quick start 在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启动的,不需要另外配置一个We ...
 - Spring Boot应用启动原理分析(转)
		
在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启动的,不需要另外配置一个Web Server. 如果之前没有使用过sprin ...
 
随机推荐
- Windows 10同步时间的方法
			
今天在安装了Windows 10 1809(October 2018 update)之后发现时间不能同步,以前并没有出现这种情况. 1) 打开控制面板,找到时钟域地区 2) 选择日期和时间 3) 选择 ...
 - [转]IIS应用程序池经典模式转集成模式解决方案
			
经典模式和集成模式的区别: IIS7.0中的Web应用程序有两种配置形式:经典形式和集成形式. 经典形式是为了与之前的版本兼容,运用ISAPI扩展来调用ASP.NET运转库,原先运转于IIS6.0下的 ...
 - [C++]字符串相关操作
			
获取字符串长度 String str str.length(); //获取String类型字符串长度 str.size(); //STL获取容器中元素个数 Char* s strlen(s); //以 ...
 - Git的操作方法
			
创建仓库 git clone 加上你的远程仓库克隆下来 git add . 把你文件里面的改动更改添加到git里面 git status 查看状态,更新了那些内容 git commit -m" ...
 - BeanUtils.copyProperties的简单示例
			
一.新建测试实体 1.UserA package com.dechy.hebswj.test; public class UserA { private String a; private Strin ...
 - python 安装第三方包时 read timed out
			
记录下安装python第三方包超时报错,解决方法:(以安装numpy为例) pip install numpy 报错:raise ReadTimeoutError(self._pool, None, ...
 - JavaScript 数组
			
JavaScript的Array可以包含任意数据类型,并通过索引来访问每个元素. 要取得Array的长度,直接访问length属性: var arr = [1, 2, 3.14, 'Hello', n ...
 - java内存性能调优编码注意
			
1.没有必要时请不用使用静态变量 使用Java的开发者都知道,当某个对象被定义为stataic变量所引用,这个对象所占有的内存将不会被回收.有时,开发者会将经常调用的对象或者变量定义为static,以 ...
 - delphi 中record 的类操作符重载简介
			
今天简单介绍一下 delphi 中record 的类操作符重载使用,就是如何 实现 record 之间的简单操作. 关于类操作符重载 ,大家可以看官方的文档. Delphi allows certai ...
 - Cannot set property 'onclick' of null报错
			
经常几个页面使用公共js文件, 原来遇到也没留意, 原来是本页面执行的时候, 其他页面也在执行并赋予id于onclick. 因为页面是正常情况下是不存在null和undefined if(null){ ...