这个问题很常见,我贴一下错误代码,作为备忘!
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")
这两个注解有一个没写。
有帮助的话,欢迎评论点个赞呗!