2016-10-13 43 views
0

我的程序中有一個循環引用。我認爲我的計劃沒有問題。它可以在windows上運行。當我將它放在linux上時,它會導致異常。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="[email protected]"/> 
    <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

當你說它不是在Windows和Linux上的相同結果,有什麼區別?你在Windows上使用IDE而不使用Linux嗎?是在這兩種情況下手動進行satart的jar還是以war/ear/jar方式放入JEE服務器?你的春天是什麼樣的? – Asoub

回答

0

是啊,有:

customUserDataManager需要processEngineConfiguration需要customUserDa taManager和圓圈開始。

+0

我在bean customUserDataManager中設置了lazy-init =「true」,我認爲它可以解決這個問題,但它不起作用。它不能運行只在 –

+0

我設置lazy-init =「true」在bean customUserDataManager,我認爲它可以解決這個問題,但它不工作。它不能只在linux上運行 –

1

檢查豆customUserDataManagerprocessEngineConfiguration你有customUserDataManager構造參考processEngineConfiguration和豆processEngineConfiguration屬性參考customUserDataManager所以它肯定是一個循環引用。

更新

除了上述循環引用請檢查customGroupDataManager豆的循環引用。

+0

重複別人的回答不是一個好的做法 –

+0

我在bean customUserDataManager中設置lazy-init =「true」,它沒有工作嗎 –

+0

@KrzysztofCichocki當我開始回答時,答案不存在。它在我點擊提交後出現。 –