1、错误信息
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userMapper in club.sscai.userservice.user.service.UserService required a bean of type 'club.sscai.userservice.user.mapper.UserMapper' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'club.sscai.userservice.user.mapper.UserMapper' in your configuration.
2、解决问题
程序启动入口少了 @MapperScan(basePackages = "club.sscai.userservice.user") 扫描 mapper 包的注解

本文详细解析了Spring应用启动失败的错误信息,指出UserMapper未找到的问题所在,并提供了解决方案,即在启动类中添加@MapperScan注解,用于扫描mapper包,确保所有mapper接口能被Spring容器识别。


424

被折叠的 条评论
为什么被折叠?



