springboot-遇到的錯誤


1、Field userMapper in com.yanan.outjob.controller.SysUserController required a bean of type 'com.yanan.outjob.dao.SysUserMapper' that could not be found.

  mapper注入失敗

  解決方法啟動類添加掃描注解 @MapperScan("com.yanan.outjob.dao")

 2、配置多個數據源報錯(more than one 'primary' bean found among candidates)

   控制台輸出:more than one 'primary' bean found among candidates: 

  很明顯,出現了不止一個的“primary”,找出primary出現的位置。多個數據源配置文件在其中兩個文件中用到了

@Primary注解,試着刪掉其中一個文件中的@Primary注解,項目正常啟動
借鑒:https://blog.csdn.net/weixin_42074377/article/details/83615895


免責聲明!

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



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