springboot启动加载自定义Banner图案
Spring Boot在启动的时候会显示一个默认的图案,对应的类为SpringBootBanner。
图案输出有以下几种模式,默认是CONSOLE的,即只打印到控制台,也可以输出到日志文件。
enum Mode { /**
Disable printing of the banner.
/
OFF, /*
Print the banner to System.out.
/
CONSOLE, /*
Print the banner to the log file.
*/
LOG
}
- 定制图案
1.在classpath目录下创建banner.txt,把图案放入该文件
2.生成图案的网站:
http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20
3.已生成的文件
链接:https://pan.baidu.com/s/1pJwKFhUCeMy1y_d6HKZoMg
提取码:h6b5
- 关闭图案
@SpringBootApplication
public class Application { public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF)
.run(args);
}}