版本:springboot2.1.1
springboot注解扫描范围是由@ComponentScan指定的;
默认情况下为启动程序xxxApplication.java所在目录及其子包;
如果要修改扫描范围,只需在xxxApplication.java添加注解
@ComponentScan(basePackages={"com.yuntsg.test1","com.yuntsg.test2"})
@ComponentScan(basePackages={"com.yuntsg"})
@SpringBootApplication
public class xxxApplication {
public static void main(String[] args) {
SpringApplication.run(xxxApplication.class, args);
}
}
网友评论