一、假設
1、maven項目
2、SpringBoot項目
3、依賴了其他公共模塊,需要將模塊Service或Compont注冊成Bean
4、依賴中的模塊,不想掃描某個包或某些包(可能沖突)
二、解決: 啟動類上增加注解
@ComponentScan(basePackages = {"cn.hg"},
excludeFilters = {
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "ch.hg.oper.*")
,@ComponentScan.Filter(type = FilterType.REGEX, pattern = "ch.hg.pay.*")
})
示例圖
————————————————
版權聲明:本文為CSDN博主「hgSuper」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/myloverisxin/article/details/118789107