springboot整合mybatis:Consider defining a bean of type 'com.mk.mapper.UserMapper'

错误信息:

Description:

Field userEntityMapper in com.xxx.xxx.service.UserService required a bean of type 'com.xxx.xxx.dao.UserEntityMapper' that could not be found.

Action:

Consider defining a bean of type 'com.xxx.xxx.dao.UserEntityMapper' in your configuration.

看了网上很多信息,说要在启动类上加@MapperScan(“com.mk.mapper”)注解或者在***Mapper接口上加@Mapper注解。
我的启动类和mapper接口都有加,并且包路径也不存在问题。可能对别人有效,但对我来说就是不行。
最后解决办法:
将@MapperScan(“com.mk.mapper”)改为@ComponentScan(basePackages = “com.mk.mapper”)解决了问题
springboot整合mybatis:Consider defining a bean of type 'com.mk.mapper.UserMapper'_第1张图片

你可能感兴趣的:(Redis)