springboot 常见注解

1.@SpringBootApplication

用在 springboot 的核心主类上,最最重要的注解,标识是一个 springboot 应用,开启springboot 的各项应用.相当于@SpringBootConfiguration,@EnableAutoConfiguration,@ComponentScan 三个注解的组合.

2. @ComponentScan 用来代替配置文件中的comment-scan配置,用来开启组件扫描,自动扫描@Comment 注解自动注册 bean 到context

3. @SpringBootConfiguration  @Configuration 注解的变体, @Configuration 是Spring 3.0 添加的一个注解,用来代替 applicationContext.xml 配置文件.

4. @EnableAutoConfiguration  Spring Boot 就能根据当前类路径下的包或者类来配置 Spring Bean

参考文献:

https://mp.weixin.qq.com/s?__biz=MzI3ODcxMzQzMw==&mid=2247488597&idx=1&sn=e3b44af93f36fce77fe69956c4e41251&chksm=eb539163dc2418754aebb15db1d6f245981bc02e9f7c19878765ba13385187ab7a777afbc3a6&mpshare=1&scene=1&srcid=#rd

猜你喜欢

转载自blog.csdn.net/u011243684/article/details/87965966