Spring and jBPM 4.3

Instead of using the following old jBPM 4.0 way, to inject those beans :

<bean id="jbpmConfiguration" p:sessionFactory-ref="sessionFactory">
  <constructor-arg value="jbpm.cfg.xml" />
</bean>
<bean id="processEngine" factory-bean="jbpmConfiguration"
      factory-method="buildProcessEngine" />
<bean id="taskService" factory-bean="jbpmConfiguration"
      factory-method="getTaskService" />
<bean id="repositoryService" factory-bean="jbpmConfiguration"
      factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="jbpmConfiguration"
      factory-method="getExecutionService" />
<bean id="historyService" factory-bean="jbpmConfiguration"
      factory-method="getHistoryService" />
<bean id="managementService" factory-bean="jbpmConfiguration"
      factory-method="getManagementService" />

jBPM 4.3 has a new Spring integration configuration :

<bean id="springHelper">
  <property name="jbpmConfiguration" value="jbpm.cfg.xml"/>
</bean>
<bean id="processEngine" factory-bean="springHelper" 
      factory-method="createProcessEngine" />

In java classes, you can simply use :

@Resource
private ProcessEngine processEngine;
...
ExecutionService executionService = processEngine.getExecutionService();
...
Advertisements