IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner
一、关闭自动配置
在jar包下找下边的名字
![](https://images2018.cnblogs.com/blog/994129/201804/994129-20180401011708332-1299873942.png)
设置关闭自动配置jar
![](https://images2018.cnblogs.com/blog/994129/201804/994129-20180401011725625-153369177.png)
多个的时候配置
![](https://images2018.cnblogs.com/blog/994129/201804/994129-20180401011748980-131486066.png)
二、自定义Banner
(2)命名为Banner.txt,resources目录中
(3)重启springboot生效
(4)取消定义的Banner
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package com.example.demo; 2 3 import org.springframework.boot.Banner; 4 import org.springframework.boot.SpringApplication; 5 import org.springframework.boot.SpringBootConfiguration; 6 import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 7 import org.springframework.boot.autoconfigure.SpringBootApplication; 8 import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; 9 import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration; 10 import org.springframework.context.annotation.ComponentScan; 11 import org.springframework.stereotype.Controller; 12 import org.springframework.web.bind.annotation.RequestMapping; 13 import org.springframework.web.bind.annotation.ResponseBody; 14 15 16 @Controller 17 @SpringBootApplication(exclude = {RedisAutoConfiguration.class,ServletWebServerFactoryAutoConfiguration.class}) 18 @SpringBootConfiguration 19 @EnableAutoConfiguration 20 @ComponentScan 21 public class Application { 22 23 @RequestMapping("hello") 24 @ResponseBody 25 public String hello(){ 26 return "hello world!"; 27 } 28 29 public Application() { 30 } 31 32 public static void main(String[] args) { 33 // SpringApplication.run(Application.class, args); 34 SpringApplication springApplication = new SpringApplication(Application.class); 35 springApplication.setBannerMode(Banner.Mode.OFF); 36 springApplication.run(args); 37 } 38 }
十年磨一剑,一剑破万法