IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner

时间:2023-03-09 00:40:06
IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner
一、关闭自动配置
在jar包下找下边的名字
  IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner
设置关闭自动配置jar
  IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner
多个的时候配置
   IntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义BannerIntelliJ IDEA 2017版 SpringBoot的关闭自动配置和自定义Banner
二、自定义Banner
   (2)命名为Banner.txt,resources目录中
  (3)重启springboot生效
  (4)取消定义的Banner
 package com.example.demo;

 import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; @Controller
@SpringBootApplication(exclude = {RedisAutoConfiguration.class,ServletWebServerFactoryAutoConfiguration.class})
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
public class Application { @RequestMapping("hello")
@ResponseBody
public String hello(){
return "hello world!";
} public Application() {
} public static void main(String[] args) {
// SpringApplication.run(Application.class, args);
SpringApplication springApplication = new SpringApplication(Application.class);
springApplication.setBannerMode(Banner.Mode.OFF);
springApplication.run(args);
}
}