SpringBoot工程使用@ComponentScan导致本工程中组件无法扫描问题
在Springboot工程中,启动类注解@SpringbootApplication本身包含了@EnableAutoConfiguration、@Configuration、@ComponentScan
@SpringbootApplication自带的扫描范围:当前所在的包以及子包
当@SpringbootApplication 和 @ComponentScan同时使用时,我们定义的@ComponentScan会覆盖本身@SpringbootApplication的扫描范围
因此我们需要在@Comp
原创
2021-05-06 15:31:16 ·
1894 阅读 ·
2 评论