SPRING循环依赖(circular reference)的解决方法
2016-03-12 13:37
896 查看
有时候,在SPRING中两个类互相含有对方的声明,一般情况这是不允许并且极可能是有错误的。
会报这个错:
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘’: Bean with name ‘’ has been injected into other beans [, ]in its raw version as part of a circular reference,
but has eventually been wrapped (for example as part of auto-proxy creation). 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, for example.
会报这个错:
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘’: Bean with name ‘’ has been injected into other beans [, ]in its raw version as part of a circular reference,
but has eventually been wrapped (for example as part of auto-proxy creation). 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, for example.
<bean id=".******"" class="com..******".web.business.activity.service.impl.******" lazy-init="true"/>
相关文章推荐
- spring security执行流程图
- Spring4新特性——集成Bean Validation 1.1(JSR-349)到SpringMVC
- java中集合类的一些简单总结
- java内存溢出
- 初识Java正则表达式
- eclipse 使用git 上传到github
- 在Java中如何高效的判断数组中是否包含某个元素
- Java之String中删除指定元素
- Java垃圾回收机制
- 做一个合格的程序猿之浅析Spring IoC源码(十)Spring Bean的初始化顺序
- [java][db]JAVA分布式事务原理及应用
- leetcode:Gas Station 【Java】
- 关于java各种类型转化为无符号和类型转化为byte数组的方法
- java创建的对象存储在哪儿
- Java编程思想学习(十三) java I/O
- Java编程思想学习(十二) 数组和容器
- 代理模式(五)JDK动态代理深入分析
- Eclipse安装SVN
- IT十八掌作业_java基础第八天_多线程
- Java的枚举值能不能用==比较?