SpringBoot的报错找不到Mapper(解决:required a bean of type com.xxx.mapper.UserMapper that could not be found)

报如下错误,大致是没有找到Mapper

Field userMapper in com.xxx.service.Impl.UserServiceImpl required a bean of type ‘com.xxx.mapper.UserMapper’ that could
not be found.Consider defining a bean of type
‘com.xxx.mapper.UserMapper’ in your configuration.

Field userMapper in com.xxx.service.Impl.UserServiceImpl
required a bean of type ‘com.xxx.mapper.UserMapper’ that could
not be found.

然后百度了一圈发现提供的办法并没有解决,且很多雷同。

最后,发现pom里导入的包需要用MyBatis提供适配SpringBoot的
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/A_hxy/article/details/106735890