天天看點

Spring boot 整合 Mybatis Plus 報 invalid bound statement (not found)錯誤

ServiceImpl上加@Primary

全網找了個遍也沒,也沒找到答案,無意中發現。真的坑人的bug,這種源碼中的報出的錯誤,都不知道怎麼解決

1、本來  invalid bound statement (not found) 這個錯誤,一般就是掃描什麼的出錯、名稱出錯之類的,一般問題不大

但是,我怎麼改都還是這個錯誤。

2、在我試了好幾種方式之後,出來這個錯誤

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or us
           

就是在spring 加載@Service的時候出現兩個一樣的bean,spring 要讓你指定一個主要的bean,使用@Primary

兩個沖突:ArticleServiceImp 和接口ArticleServcie,我不明白這兩個怎麼就沖突了,一個是接口,不應該會被加載的呀

@Service
@Primary
public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> implements ArticleService {
           

3、原因:我想使用 ArticleService調用Mybatis Plus 封裝好的方法

自己動手內建,練習一下 

繼續閱讀