我的程序中有一个循环引用。我认为我的计划没有问题。它可以在windows
上运行。当我把它放在linux
上时,会导致异常。
以下是错误日志:
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'customGroupDataManager':
Requested bean is currently in creation: Is there an unresolvable circular reference?`
以下是我的代码:
<bean id="customUserDataManager" lazy-init="true" class="com.hand.hap.activiti.manager.CustomUserDataManager">
<constructor-arg ref="processEngineConfiguration"/>
</bean>
<bean id="customBehaviorFactory" class="com.hand.hap.activiti.custom.CustomBehaviorFactory"/>
<bean id="activitiBeanProvider" class="com.hand.hap.activiti.custom.ActivitiBeanProvider"/>
<bean id="notificationListener" class="com.hand.hap.activiti.listeners.NotificationListener"/>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="databaseSchemaUpdate" value="true"/>
<property name="mailServerHost" value="smtp.126.com"/>
<property name="mailServerPort" value="25"/>
<property name="mailServerUsername" value="hap_dev@126.com"/>
<property name="mailServerPassword" value="hapdev11"/>
<property name="asyncExecutorActivate" value="true"/>
<property name="dbIdentityUsed" value="false"/>
<property name="activityBehaviorFactory" ref="customBehaviorFactory"/>
<property name="groupDataManager" ref="customGroupDataManager"/>
<property name="userDataManager" ref="customUserDataManager"/>
<property name="beans" ref="activitiBeanProvider"/>
<property name="customDefaultBpmnParseHandlers" >
<list>
<bean class="com.hand.hap.activiti.custom.AddListenerUserTaskParseHandler">
<constructor-arg index="0" value="create"/>
<constructor-arg index="1" ref="notificationListener"/>
</bean>
</list>
</property>
</bean>
答案 0 :(得分:1)
检查bean customUserDataManager
和processEngineConfiguration
您对processEngineConfiguration
中customUserDataManager
的构造函数引用以及bean customUserDataManager
中processEngineConfiguration
的属性引用所以它肯定是一个循环引用。
<强>更新强>
除上述循环引用外,请检查customGroupDataManager
bean以获取循环引用。
答案 1 :(得分:0)
是的,有:
customUserDataManager需要processEngineConfiguration,它需要customUserDataManager,并且圆圈开始。