SPRING循环依赖(circular reference)的解决方法

来源:互联网 发布:网络转换器辐射大吗 编辑:程序博客网 时间:2024/05/14 20:36

有时候,在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.

 <bean id=".******"" class="com..******".web.business.activity.service.impl.******" lazy-init="true"/>
0 0
原创粉丝点击