天天看點

Could not autowire. No beans of ‘xxxMapper‘ type found.

在使用IDEA編寫代碼過程中,你可能會遇到這種情況:

Could not autowire. No beans of 'xxxMapper' type found. 

一般情況下,這種錯誤是不影響正常編譯的。如果非要解決這個問題,

這裡我提供2種解決方法供大家參考。

目錄

​​一、第一種解決辦法​​

​​二、第二種解決辦法​​

Could not autowire. No beans of ‘xxxMapper‘ type found.

一、第一種解決辦法

在Mapper類中加入@Mapper注解(這種方法适用于改動檔案比較少的情況,如果需要改動檔案比較多,那麼中這種方法,明顯有點費力。)

Could not autowire. No beans of ‘xxxMapper‘ type found.

二、第二種解決辦法

降低Autowired檢測的級别,将Severity的級别由之前的error改成warning或其它可以忽略的級别。