启动图案

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 & Cloud 最强技术教程

Spring Boot定制启动图案的更多相关文章

  1. Spring Boot制作启动图案

    SpringBoot在启动时会有一个默认图案的,如果不喜欢可以自己制作一个. 在resources的目录下新建banner.txt文件. 制作图案地址:springboot启动图案定制 通过输入字符串 ...

  2. Spring Boot 设置启动时banner

    Spring Boot项目再启动的时候默认会在控制台输出一个字符banner图案,如下图: 我们可以通过下面的方法关闭启动时显示字符banner图案: 关闭banner方法一: public stat ...

  3. spring boot无法启动,或者正常启动之后无法访问报404的解决办法

    以前用spring boot都是用idea的自动创建,或者是用的Jhipster创建的,就没有深究怎么去搭建.但是今天晚上心血来潮,想自己搭一个demo来整合一些技术,于是就花一点时间来手动搭.因为今 ...

  4. spring boot容器启动详解

    目录 一.前言 二.容器启动 三.总结 =======正文分割线====== 一.前言 spring cloud大行其道的当下,如果不了解基本原理那么是很纠结的(看见的都是约定大于配置,但是原理呢?为 ...

  5. 让Spring Boot项目启动时可以根据自定义配置决定初始化哪些Bean

    让Spring Boot项目启动时可以根据自定义配置决定初始化哪些Bean 问题描述 实现思路 思路一 [不符合要求] 思路二[满足要求] 思路三[未试验] 问题描述 目前我工作环境下,后端主要的框架 ...

  6. Spring boot自定义启动字符画(banner)

    spring boot项目启动时会打印spring boot的ANSI字符画,可以进行自定义. 如何自定义 实现方式非常简单,我们只需要在Spring Boot工程的/src/main/resourc ...

  7. spring boot 项目启动无任何反应

    遇到的问题 spring boot项目启动后无任何报错,ps有进程,nohub无日志 定位 更换jar包,问题依然存在,将jar包放到其他服务器,运行正常,排除打包问题 同服务器其他系统运行正常,但停 ...

  8. spring boot应用启动原理分析

    spring boot quick start 在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启动的,不需要另外配置一个We ...

  9. Spring Boot应用启动原理分析(转)

    在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启动的,不需要另外配置一个Web Server. 如果之前没有使用过sprin ...

随机推荐

  1. 如何利用sql 读取辅表的最大max 和第二最大max。。。。

    SELECT `主表`.id, `主表`.title, `辅表`.* FROM tableB AS `辅表` INNER JOIN tableA AS `主表` ON `主表`.id = `辅表`.f ...

  2. java学习笔记(二):枚举值

    枚举值的作用:枚举限制了变量要有一些预先定义的值,运用枚举值可以大大减少你的代码中的漏洞,举例来说,如果我们想为一家鲜榨果汁店编个程序,就可以将杯子的尺寸限制为小中和大.这样就可以确保人们不会定大中小 ...

  3. linux grep (linux查找关键字在php出现的次数)

    http://www.th7.cn/system/lin/201508/127681.shtml 查找CleverCode在当前目录以及子目录,所有的php出现大于0的次数. # find -type ...

  4. centos7源码安装heartbeat可能出现的错误以及解决办法

    问题:ipmilan_command.c: In function 'setup_ipmi_conn':ipmilan_command.c:283:2: error: 'sel_alloc_selec ...

  5. Django缓存设置

    由于Django构建得是动态网站,每次客户端请求都要严重依赖数据库,当程序访问量大时,耗时必然会更加明显,最简单解决方式是使用:缓存,缓存将一个某个views的返回值保存至内存或者memcache中, ...

  6. [leetcode]44. Wildcard Matching万能符匹配

    Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '? ...

  7. BootStrap初始

    序言 什么是Bootstrap Bootstrap 是一个用于快速开发 Web 应用程序和网站的前端框架.Bootstrap 是基于 HTML.CSS.JAVASCRIPT 的. Bootstrap是 ...

  8. c++11 线程池学习笔记 (一) 任务队列

    学习内容来自一下地址 http://www.cnblogs.com/qicosmos/p/4772486.html github https://github.com/qicosmos/cosmos ...

  9. MyAdvice 填充方法(在原有方法上添加方法)

    //applicationContext.xml配置文件  /UserServiceImp继承于UserService接口 <!-- 1 配置目标对象-->    <bean nam ...

  10. linux 查看内网流量

    可以使用iftop进行Linux机器的网络流量监控 安装方法 centos系统下 第一步:安装EPEL源 yum install epel-release 第二部:安装iftop yum instal ...