mapper无法注入的问题
SpringBoot整合Mybatis,mapper无法注入
Description:
Field sysUserMapper in com.wzugx.mxbbx.serviceimpl.UserServiceImpl required a bean of type 'com.wzugx.mxbbx.mapper.SysUserMapper' that could not be found.
Action:
Consider defining a bean of type 'com.wzugx.mxbbx.mapper.SysUserMapper' in your configuration.
排除方法:
1、检查dao层的接口类是不是没有加@mapper注解
2、检查pom.xml的jar包依赖
然后你发现都没有错,注解加了,pom也有,就是下面的内容,复制过来了好几遍。
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.1</version>
</dependency>
但是实际上就是依赖的问题,应该是下面的依赖
<!--Mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
还没有评论,来说两句吧...