cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti 5.17.0 and spring configuration

butik
Champ in-the-making
Champ in-the-making
Hello,

I have rest web application who were based on previous version of activiti rest(5.16.4), now I'm migrating it to latest version and faced some problem with circular spring dependency.

here is my spring config:
<code>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   …
    <property name="typedEventListeners">
        <map>
            <entry key="TASK_ASSIGNED" >
                <list>
                   <ref bean="setTaskVariablesListener" />
               </list>
            </entry>
         </map>
    </property>
     …
</bean>


<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
     <property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>

<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />

<bean id="setTaskVariablesListener" class="com.project.engine.event.SetTaskVariablesListener">
       <property name="taskService" ref="taskService" />  —-   problem is here
</bean>

<code>

I have to set some listener to process engine configuration, this listener depends on task service, but task service couldn't be created without process engine who depends on process engine configuration, so I'm getting some initialization exception.

At previous activiti version it was solved with AcivitiUtil.getTaskService(), but it's removed from version 5.17.0.

Could, somebody, please advise how it can be solved?


Thanks,
Pavel
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
Hmm i see how that would be a circular dependency. One option to solve it is to make the dependency not explicit, but use for example ApplicationContextAware interface.