我是靠谱客的博主 细腻啤酒,最近开发中收集的这篇文章主要介绍springBoot:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire fi,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(39)

评论列表共有 0 条评论

立即
投稿
返回
顶部