我想实现弹簧索引器,但我的 application.xml 中的循环依赖导致了问题。我得到的错误:
相关原因:
org.springframework.beans.factory.BeanCreationException:创建类路径资源[application-dwr.xml]中定义的名称为“accountAdminAjaxService”的bean时出错:无法创建类型的内部bean“echosign.web.spring.account.AccountAdminAjaxServiceImpl#71f0f5d0” [echosign.web.spring.account.AccountAdminAjaxServiceImpl] 同时设置 bean 属性“目标”;嵌套异常是 org.springframework.beans.factory.BeanCreationException:在类路径资源 [application-dwr.xml] 中定义名称为“echosign.web.spring.account.AccountAdminAjaxServiceImpl#71f0f5d0”的 bean 创建错误:无法解析对 bean 的引用userSettings' 同时使用键 [TypedStringValue: value [USER_SETTINGS], target type [null]] 设置 bean 属性 'containerMap';嵌套异常是 org.springframework.beans.factory。BeanCreationException:在类路径资源 [application-dwr.xml] 中定义名称为“userSettings”的 bean 创建错误:在设置 bean 属性“accountAdminAjaxService”时无法解析对 bean“accountAdminAjaxService”的引用;嵌套异常是 org.springframework.beans.factory.BeanCurrentlyInCreationException:创建名为“accountAdminAjaxService”的 bean 时出错:org.springframework.beans.factory.FactoryBeanNotInitializedException:无法确定代理的目标类
代码:
<bean id="accountAdminAjaxService" parent="dwrServiceTemplate">
<property name="target">
<bean class="echosign.web.spring.account.AccountAdminAjaxServiceImpl">
<property name="containerMap">
<map>
<entry key="USER_SETTINGS" >
<ref bean="userSettings" />
</entry>
</map>
</property>
</bean>
</property>
</bean>
'userSettings' bean 引用回 'accountAdminAjaxService' bean:
<bean id="userSettings" parent="accountUserList" class="echosign.web.spring.account.container.UserSettingsContainer">
<property name="accountAdminAjaxService" ref="accountAdminAjaxService" /> </bean>
有什么办法可以分开这些豆子,不相互依赖。谢谢!