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);
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM