springboot核心注解小记

springboot核心注解为:@SpringBootApplication

该注解由以下几个注解组成:

@EnableAutoConfiguration

允许springboot自动配置注解,springboot会根据当前类路径下的包或者类来配置spring bean

@Configuration

Spring3.0添加的注解,用来代替applicationContext.xml配置文件

@SpringBootConfiguration

这个注解就是 @Configuration 注解的变体,只是用来修饰是 Spring Boot 配置而已,或者可利于 Spring Boot 后续的扩展。

@ComponentScan

这是 Spring 3.1 添加的一个注解,用来代替配置文件中的 component-scan 配置,开启组件扫描,即自动扫描包路径下的 @Component 注解进行注册 bean 实例到 context 中。




原文地址:https://www.cnblogs.com/flysand/p/14707076.html