SpringBoot花里胡哨之定制Banner

1.新建一个Springboot项目

在resource下新建一个banner.txt文件

找一个可以生成txt艺术字的网站

我用的第一个网站生成的。

直接复制到banner.txt中

//banner.txt
'     _____            _             ____              _   
'    / ____|          (_)           |  _ \            | |  
'   | (___  _ __  _ __ _ _ __   __ _| |_) | ___   ___ | |_ 
'    \___ \| '_ \| '__| | '_ \ / _` |  _ < / _ \ / _ \| __|
'    ____) | |_) | |  | | | | | (_| | |_) | (_) | (_) | |_ 
'   |_____/| .__/|_|  |_|_| |_|\__, |____/ \___/ \___/ \__|
'          | |                  __/ |                      
'          |_|                 |___/                       

控制台出现修改后的banner.设置成功!

附 :关闭banner

只需要在项目启动类的main方法下添加这几行,代码如下:

SpringApplicationBuilder builder = new SpringApplicationBuilder(TestSpringBootApplication.class);
//此处的TestSpringBootApplication.class根据自身情况进行修改
		builder.bannerMode(Banner.Mode.OFF).run(args);

通过SpringApplicationBuilder来设置bannerMode为OFF,就能关闭banner了。

猜你喜欢

转载自www.cnblogs.com/jshmztl/p/13386384.html