首页 > 其他 > 详细

Error creating bean with name

时间:2019-11-12 21:33:33      阅读:118      评论:0      收藏:0      [点我收藏+]

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘XXXXX‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: XXXXXXX; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [XXXXXX] 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.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)

 

原因是在autowire时,找不到相应的类,上述问题是因为XXXXX的实现类中没有加相应的注解。如dao层 @Repository  如service层  @Service

 

类似的这个错误,如果你要恰好碰到了,那么可以跟我一样检查一下你需要注解的类有没有给他添加对应功能的注解

例如跟我下图一样的,我就是忘记了添加这一个

技术分享图片

 

 

Error creating bean with name

原文:https://www.cnblogs.com/waibizi/p/11845036.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!