做一個小項目,因為有 baseService,所以偷懶就沒有寫單獨的每個xxService接口,直接寫的xxServiceImpl,結果在service實現類中注入Mapper的時候,用的 @Autowired,
結果,junit一啟動,就報錯誤:Java.lang.illegalStateException:Failed to load ApplicationContext
具體是在 創建bean的時候報:No qualifying bean of type 'xxx.xxMapper' abailable:expected at least 1 bean which qualifies as autowire candidate.......
錯誤,
經過百度即測試,發現解決方法是:
在@Autowired 注解下面加上@Qualifier(“xxxxxMapper”)注解