SpringBoot整合MybatisPlus启动时报错: org.springframework.beans.factory.UnsatisfiedDependencyException
程序员文章站
2022-05-29 17:14:25
...
SpringBoot整合MybatisPlus在启动时直接报错
报错重点信息如下:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.jia.vueblog.mapper.BlogMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1700) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1256) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1210) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
可能造成报错的问题:
- XXMapper.java 中未添加@Mapper注解或者Application主启动类中未添加@MapperScan("")注解。
- 注解配置不完整,如Service实现类没有加@Service,Spring boot无法扫描等。
- application.yml / application.properties中mapper-locations配置内容有误
- @MapperScan("")注解中包路径写错
检查发现是@MapperScan("")注解中包路径写错导致问题发生。
上一篇: 排错!MySQL初始化数据库报错
推荐阅读
-
SpringBoot整合MybatisPlus的简单教程实现(简单整合)
-
SpringBoot整合MyBatisPlus配置动态数据源的方法
-
springboot整合websocket后运行测试类报错:javax.websocket.server.ServerContainer not available
-
SpringBoot整合mybatis访问时报错Invalid bound statement (not found)
-
SpringBoot2.x整合MybatisPlus3.x,实现数据的简单CRUD操作+****代码生成
-
springboot+druid+mybatisplus使用注解整合连接多个数据库
-
SpringBoot整合MybatisPlus+单表CRUD(详解)
-
5、SpringBoot整合之SpringBoot整合MybatisPlus
-
Springboot整合Gson报错问题解决过程
-
一篇超详细的SpringBoot整合MybatisPlus的文章