启动项目,通过@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. sql server中like无法匹配下划线问题解决方案

    在sql server的like中下划线类似于通配符%,所以无法使用like '%_%'来匹配下划线,可以通过以下两种办法实现匹配下划线 1.使用转义字符escape like '%\_%' esca ...

  2. bzoj 2151 种树 —— 思路+链表

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2151 先都放进堆里取最大的,但选了一个就不能选它两边的,所以可能不是最优,要有“反悔”的措施 ...

  3. ASP.NET Core MVC 2.x 全面教程_ASP.NET Core MVC 06. Controller 返回View

    Controller父类会提供很多上下文的相关信息,还提供了很多封装的方法 返回的对象要求实现了IActionResult接口 继承父类,并引入命名空间 写this点就出现很多东西,这些就是上下文的信 ...

  4. Unity网格合并_材质合并[转]

    http://blog.csdn.net/chenggong2dm/article/details/41699029

  5. ARM汇编中ldr伪指令和ldr指令(转载)

    转自:http://blog.csdn.net/ce123_zhouwei/article/details/7182756 ARM是RISC结构,数据从内存到CPU之间的移动只能通过L/S指令来完成, ...

  6. liteos内存(三)

    1. 概述 1.1 基本概念 内存管理模块管理系统的内存资源,它是操作系统的核心模块之一.主要包括内存的初始化.分配以及释放. 在系统运行过程中,内存管理模块通过对内存的申请/释放操作,来管理用户和O ...

  7. shell初级-----数据呈现方式

    输入与输出 Linux系统将每个对象当作文件处理,这包括输入和输出进程.Linux用文件描述符来标识每个文件对象.文件描述符是一个非负整数,可以唯一标识会话中打开的文件.每个进程一次多可以有九个文件描 ...

  8. 洛谷P2585 [ZJOI2006]三色二叉树(树形dp)

    传送门 设$dp[u][i]$表示点$u$颜色为$i$时最多(最少)的绿点个数(这里用$0$表示绿点) 然后直接用树形dp就可以了 记得把情况讨论清楚 //minamoto #include<b ...

  9. thinkphp整合swoole

    cli模式下执行thinkphp1.cd 项目根目录2.php index.php admin/index/index --执行 模块/控制器/方法名 异步消息队列1.服务器端核心代码 /** * 脚 ...

  10. web前端图片预加载

    是什么? 浏览器会缓存静态资源(hmtl/css/img等).图片预加载就是让浏览器提前缓存图片,提升用户体验. 浏览器什么情况下会下载图片? 1,解析到html中img的src属性的时候 2,解析到 ...