一、关闭自动配置
在jar包下找下边的名字
设置关闭自动配置jar
多个的时候配置
二、自定义Banner
(2)命名为Banner.txt,resources目录中
(3)重启springboot生效
(4)取消定义的Banner
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 }