概述
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wn.boot.dao.PersonRespository com.wn.boot.test.GirlController.personRespository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.wn.boot.dao.PersonRespository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
... 17 common frames omitted
解决方法:
springBoot入口类(main函数所在类)的包名为com.wn.test
则dao层和service的类放在com.wn.test下或子包下才能被扫描到。
最后
以上就是细腻啤酒为你收集整理的springBoot:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire fi的全部内容,希望文章能够帮你解决springBoot:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire fi所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复