springboot指定注解扫描范围

Posted zsg88

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot指定注解扫描范围相关的知识,希望对你有一定的参考价值。

springboot注解扫描范围是由@ComponentScan指定的;
默认情况下为启动程序所在目录及其子包;

如果需要指定扫描路径,在启动程序中添加修改

@ComponentScan(basePackages="org.jstudio.a","org.jstudio.b")
@SpringBootApplication
public class xxxApplication 
    public static void main(String[] args) 
    SpringApplication.run(xxxApplication.class, args);
    

 

以上是关于springboot指定注解扫描范围的主要内容,如果未能解决你的问题,请参考以下文章