
springboot报错——Field userMapper in xx.xx required a bean of type 'xx.mapper' that could not be found.
报错内容
Description:
Field userMapper in com.zxb.boot3.ssm.controller.UserController required a bean of type 'com.zxb.boot3.ssm.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 'com.zxb.boot3.ssm.mapper.UserMapper' in your configuration.
解决方法
手动在启动类上添加 mapper
扫描
@SpringBootApplication
@MapperScan("com.zxb.boot3.ssm.mapper")
public class Boot305SsmApplication {
public static void main(String[] args) {
SpringApplication.run(Boot305SsmApplication.class, args);
}
}
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 zxb
评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果