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

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

站点统计

  • 文章总数:315 篇
  • 分类总数:20 个
  • 标签总数:193 个
  • 运行天数:1127 天
  • 访问总数:12667 人次

浙公网安备33011302000604

辽ICP备20003309号