2021
01-29
01-29
springboot bean扫描路径的实现
1:默认扫描启动类所在路径下所有的bean2:可以在启动类中添加注解,手动指定扫描路径:@ComponentScan(basePackages={"com.xxx.service1.*","com.xxx.service2.**"})补充:SpringBoot是如何通过@SpringBootApplication扫描项目中的Bean原因首先因为XXXXXXXApplication附带@SpringBootApplication注解,而@SpringBootApplication注解的层次如下:SpringBootApplication----@Inherited----@SpringBootConfiguration--------...
继续阅读 >