@SpringBootApplication是一个组合注解,该源码如下所示
@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Configuration @EnableAutoConfiguration @ComponentScan public @interface SpringBootApplication { Class<?>[] exclude() default {}; String[] excludeName() default {}; }其中
@EnableAutoConfiguration是让Spring Boot根据类路径中的jar包以来为当前项目进行自动配置
Spring Boot默认启动图案为
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/如果要关闭特定的自动配置,应该使用@SpringBootApplication注解中的exclude参数,例如
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
修改banner:
1.在src/main/resources目录下,新建banner.txt
2.打开该网页
http://patorjk.com/software/taag自定义文字内容以及字体,并复制到banner.txt.
如何关闭banner:
Spring Boot的main方法内容为
SpringApplication.run(Application.class, args)如果要关闭banner,将内容修改为
SpringApplication app=new SpringApplication(application.class); app.showbanner(false); app.run(args);或者修改为
new SpringApplication(application.class) .showbanner(flase) .run(args);