启动项目,通过@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的更多相关文章

  1. Spirng 循环依赖报错:Requested bean is currently in creation: Is there an unresolvable circular reference?

    1:前言 最近在项目中遇到了一次循环依赖报错的问题,虽然解决的很快,但是有些不明白的地方,特此记录. 在此我把 bean 的结构和 注入方式单独拎出来进行演示 1.1:报错提示 1.2:错误日志 Ex ...

  2. SpringBoot项目意外出现 循环依赖和注入的对象意外是Null的问题 Requested bean is currently in creation: Is there an unresolvable circular reference? 或 nested exception is java.lang.NullPointerException

    1.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...

  3. Requested bean is currently in creation: Is there an unresolvable circular reference?

    spring容器初始化报错:循环依赖,错误信息如下: Requested bean is currently in creation: Is there an unresolvable circula ...

  4. 创建在类路径资源[applicationcontext]中定义名为“工厂”的bean时出错。:在设置bean属性“dataSource”时,无法解析对bean“dataSource”的引用;嵌套异常是org.springframe .beans.factory。BeanCreationException:创建名为“数据源”的bean时出错,该名称是在类路径资源[applicationcontext

    控制台报错: 创建在类路径资源[applicationcontext]中定义名为“工厂”的bean时出错.:在设置bean属性“dataSource”时,无法解析对bean“dataSource”的引 ...

  5. springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?

    2018-07-31 11:56:18.812 WARN 10316 --- [ main] ConfigServletWebServerApplicationContext : Exception ...

  6. 【异常】Application failed to start due to an exception org.springframework.beans.factory.BeanCurrentlyInCreationException

    一. 异常信息:   2018-05-17 18:03:22.224 -DEBUG [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   ...

  7. spring 拾遗

    1.@PostConstruct VS  init-method 1.1 both BeanPostProcessor 1.2 @PostConstruct is a JSR-250 annotati ...

  8. Spring IoC源码解析——Bean的创建和初始化

    Spring介绍 Spring(http://spring.io/)是一个轻量级的Java 开发框架,同时也是轻量级的IoC和AOP的容器框架,主要是针对JavaBean的生命周期进行管理的轻量级容器 ...

  9. spring源码 — 二、从容器中获取Bean

    getBean 上一节中说明了容器的初始化,也就是把Bean的定义GenericBeanDefinition放到了容器中,但是并没有初始化这些Bean.那么Bean什么时候会初始化呢? 在程序第一个主 ...

随机推荐

  1. HDU2295 Radar —— Dancing Links 可重复覆盖

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2295 Radar Time Limit: 2000/1000 MS (Java/Others)     ...

  2. 计算机学院大学生程序设计竞赛(2015’12)Study Words

    Study Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  3. lovelygallery_popup(卡哇依相册)

    /*************************** 相册 ***************************/LovelyGallery 功能特点:超过200个令人惊叹的3D&2D硬 ...

  4. 如何反编译silverlight

     @years(945060991)  15:10:28问一下  如何反编译silverlight观,一世沧桑如画♥(752816388)  15:10:46解压就行@years(945060991) ...

  5. [Selenium] 操作浏览器 Cookies

    WebDriver 提供了一系列 Cookies 的操作来获取.填写.删除 Cookies 的方法,节省了多次在登陆页面的查找元素并填写登录信息的时间. 1)获取 Cookies ,并保存到文件中以备 ...

  6. Bootstrap-CSS:响应式实用工具

    ylbtech-Bootstrap-CSS:响应式实用工具 1.返回顶部 1.  Bootstrap 响应式实用工具 Bootstrap 提供了一些辅助类,以便更快地实现对移动设备友好的开发.这些可以 ...

  7. caffe 入门实例3 fine-turning

    占坑,使用fine-turning初始化参数...

  8. git cherry-pick简介(转载)

    转自:http://hubingforever.blog.163.com/blog/static/1710405792012587115533/ 本文编辑整理自: http://sg552.iteye ...

  9. E20170403-gg

    thumbnail 缩略图 inherit     vt. 继承; vt. 经遗传获得(品质.身体特征等),继任; opacity 不透明度   flat     adj. 平的; 单调的; 不景气的 ...

  10. poj1159 【LCS】

    思路: 滚动数组; 贴一发挫code- #include <iostream> #include <cstdio> #include <string.h> #inc ...