SPRING循環依賴(circular reference)的解決方法

有時候,在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"/>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章