Spring Boot 中@Componentscan 和@EnableAutoConfiguration 的区别
问题引出
学习springboot配置原理的时候,注解@SpringBootApplication下有三个注解,@SpringBootApplication、@EnableAutoConfiguration以及@ComponentScan,感觉后两个都是包扫描的配置,有点分不清。这里做一个辨析:
区别
这两个注释之间的基本区别是@ComponentScan 扫描 Spring 组件,也就是我们平时开发用的@Controller/@Service/@Component/@Repository这些注解是由Co
原创
2021-09-06 17:37:52 ·
1578 阅读 ·
1 评论