1、SpringbootApplication
Spring Boot的项目一般都会有*Application的入口类,入口类中会有main方法,这是一个标准的Java应用程序的入口方法。
@SpringBootApplication注解是Spring Boot的核心注解,它其实是一个组合注解:

2、springboot注解主要组合注解@SpringBootConfiguration和@EnableAutoConfiguration。
2.1、@SpringBootConfiguration:这是Spring Boot项目的配置注解,这也是一个组合注解:

2.2、2.@EnableAutoConfiguration:启用自动配置,该注解会使Spring Boot根据项目中依赖的jar包自动配置项目的配置项:
如:我们添加了spring-boot-starter-web的依赖,项目中也就会引入SpringMVC的依赖,Spring Boot就会自动配置tomcat和SpringMVC

3、3.@ComponentScan:默认扫描@SpringBootApplication所在类的同级目录以及它的子目录。
4、关闭自动注解
通过上述,我们得知,Spring Boot会根据项目中的jar包依赖,自动做出配置,Spring Boot支持的自动配置如下(非常多):

比如:我们不想自动配置Redis,想手动配置。

5、自定义banner
首先生成文字:
用谷歌浏览器打开查看生成的图片效果一般,建议换火狐等
http://patorjk.com/software/taag/#p=display&h=3&v=3&f=4Max&t=Winney%20spring
然后复制文字并且放在命名为banner.txt的文本文件下,并且将文件放在classpath目录下。

6、关闭banner
public static void main(String[] args) {
// TODO Auto-generated method stub
SpringApplication app = new SpringApplication(HelloApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
网友评论