修改spring Boot启动时的默认图案Banner

一.修改Banner

spring Boot启动的时候会有一个默认的启动图案。如下图

[plain] view plain copy
  1.   .   ____          _            __ _ _  
  2.  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \  
  3. ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \  
  4.  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )  
  5.   '  |____| .__|_| |_|_| |_\__, | / / / /  
  6.  =========|_|==============|___/=/_/_/_/  
  7.  :: Spring Boot ::        (v1.4.3.RELEASE)  
下面我们来修改上面默认启动的图案。

操作步骤:

(1).在src/main/resources路径下新建一个banner.txt文件,并输入想要的内容即可。

(2).我这里面用在线生成图案的网站 http://patorjk.com/software/taag/ 如图

(3).将生成的内容粘贴到banner.txt中,并保存和重新启动就可以看到效果了。

二.关闭Banner

想要关闭Banner内容,只需要修改Main函数即可,我这里提供一种方法。

[plain] view plain copy
  1. @SpringBootApplication  
  2. @RestController  
  3. public class Application {  
  4.     @RequestMapping("/")  
  5.     public String greeting() {  
  6.         return "Hello World!";  
  7.     }  
  8.   
  9.     public static void main(String[] args) {  
  10.         //SpringApplication.run(Application.class, args);  
  11.         SpringApplication newRun= new SpringApplication(Application.class);   
  12.         newRun.setBannerMode(Banner.Mode.OFF);  
  13.         newRun.run(args);  
  14.     }  
  15. }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值