这个问题很常见,我贴一下错误代码,作为备忘!

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testZjfService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cf.mmi.dao.mapper.TestZjfMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:321)

看到这种全是Mapper的报错其实不一定就是@service|| @Mapper ||@Component注解没写
还有一个可能的原因是springboot启动类的

@ComponentScan(basePackages = {"com.xx"})
@MapperScan("com.xx.xx.dao.mapper")

这两个注解有一个没写。

有帮助的话,欢迎评论点个赞呗!

分类: java

0 条评论

发表评论

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注

站点统计

  • 文章总数:304 篇
  • 分类总数:19 个
  • 标签总数:189 个
  • 运行天数:852 天
  • 访问总数:459553 人次
ICP备案号: 辽ICP备20003309号