一、SpringBoot常用注解:
1、@SpringBootApplication
这是 Spring Boot 最最最核心的注解,用在 Spring Boot 主类上,标识这是一个 Spring Boot 应用,用来开启 Spring Boot 的各项能力。
其实这个注解就是 @SpringBootConfiguration、@EnableAutoConfiguration、@ComponentScan 这三个注解的组合,也可以用这三个注解来代替 @SpringBootApplication 注解。
2、@Configuration
这是 Spring 3.0 添加的一个注解,用来代替 applicationContext.xml 配置文件,所有这个配置文件里面能做到的事情都可以通过这个注解所在类来进行注册。
文章介绍了SpringBoot的两个关键注解:@SpringBootApplication是SpringBoot应用的标志,结合了@SpringBootConfiguration、@EnableAutoConfiguration和@ComponentScan的功能;@Configuration则用于替代XML配置文件,实现Java配置。

被折叠的 条评论
为什么被折叠?



