SpringBoot整合mybatis-plus異常:Unsatisfied dependency expressed through field 'mapper'解決辦法


報錯信息截取:

Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean 

解決辦法:springboot啟動類上加 @MapperScan();注解,如下

@SpringBootApplication
@MapperScan(value = "com.xxxxx.xxxx.mapper")
public class ManagesysApplication {

:網上還有一種寫法:就是在mapper接口上添加@Mapper注解,然而這種寫法並不能解決掃包不全的問題。用上面的做法,指定掃描路徑即可。


免責聲明!

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



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