spring整合mybatis之坑。注解@Mapper无效

首先,贴下错误信息

当出现

The injection point has the following annotations:

- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type '****.SysUserMapper' in your configuration.

错误时,一般来说,都是注解无效。

引用其他大佬的文章及解决方案。一直在找相关的解决方法。

在这里记录下。

简单的说,这里就是,某某对象未能正常的实例化。

在此呢,尝试了多个方法。

1.在mapper/server中,没有添加对应的注解。导致无法实例化。

2.在Application(启动类)中,未添加@MapperScan注解。

3.pom.xml中,没有引入的mybatis

4.在配置文件中,添加mybatis的配置引用,却没有找到对应的mybatis对应的配置文件.(configLocation)

猜你喜欢

转载自blog.csdn.net/baidu_39066396/article/details/123285930