码迷,mamicode.com
首页 > 移动开发 > 详细

Bean with name 'xxxService' has been injected into other beans [xxxServiceA,xxxServiceB] in its raw version as part of a circular reference, but has eventually been wrapped

时间:2019-01-09 20:21:44      阅读:664      评论:0      收藏:0      [点我收藏+]

标签:ted   www   turn   counter   sharp   during   ati   exce   over   

 

启动项目,通过@Autowired注入对象,出现循环依赖,导致项目启动失败,具体报错信息如下: 

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘xxxtController‘: 
Unsatisfied dependency expressed through field ‘xxxService‘; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: 
Error creating bean with name ‘xxxService‘: Bean with name ‘xxxService‘ has been injected into other beans [xxxServiceA,xxxServiceB] 
in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. 
This is often the result of over-eager type matching - consider using ‘getBeanNamesOfType‘ with the ‘allowEagerInit‘ flag turned off

  

Bean with name ‘xxxService‘ has been injected into other beans [xxxServiceA,xxxServiceB] in its raw version as part of a circular reference, but has eventually been wrapped
翻译:xxxService 这个bean已经被注入到xxxServiceA、xxxServiceB这两个bean中了,他们之间存在循环引用(依赖),也就是说:xxxServiceA中注入了xxxService,而xxxService中也要注入xxxServiceA,所以就会出现这种情况

 

参考:https://www.cnblogs.com/leng39/p/9530569.html

 

Bean with name 'xxxService' has been injected into other beans [xxxServiceA,xxxServiceB] in its raw version as part of a circular reference, but has eventually been wrapped

标签:ted   www   turn   counter   sharp   during   ati   exce   over   

原文地址:https://www.cnblogs.com/quan-coder/p/10245562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!