记录bug:dao自动注入失败

dao自动注入失败错误的一种奇葩形式

14:30:49,629 ERROR DispatcherServlet:503 - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'checkItemServiceImpl': Unsatisfied dependency expressed through field 'checkItemDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.health.dao.CheckItemDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

这是我的文件结构,这些都是在provider项目中的

这是运行backend和provider项目时候,backend项目会报错,意思是有个dao自动注入失败了,autowared没有起作用,但是这些dao应该是在provider项目才对,provider项目那边并没有报错。

仔细查找错误发现,这是backend项目的坐标:

真相就是:

在backend中把provider当依赖引入了,backend中有自己本地的一份provider代码参与运行,但是backend里面容器中没有dao的,所以就一直报错dao注入失败

posted @ 2020-03-15 22:55  卯毛  阅读(923)  评论(0编辑  收藏  举报