jbpm4.4與Spring整合

與Spring的整合很簡單:

  1)把事務交給Spring管理。 spring

  2)經過Spring獲取流程引擎ProcessEngine。 session

在項目的src目錄下添加jbpm.cfg.xml文件: app

<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>

  <import resource="jbpm.default.cfg.xml" />
  <import resource="jbpm.businesscalendar.cfg.xml" />
  <!-- <import resource="jbpm.tx.hibernate.cfg.xml" /> -->
  <!-- 與Spring整合使用 -->
  <import resource="jbpm.tx.spring.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
  <import resource="jbpm.bpmn.cfg.xml" />
  <import resource="jbpm.identity.cfg.xml" />

  <!-- Job executor is excluded for running the example test cases. -->
  <!-- To enable timers and messages in production use, this should be included. -->
  <!--
  <import resource="jbpm.jobexecutor.cfg.xml" />
  -->

</jbpm-configuration>
ide

在Spring的配置文件applicationContext.xml添加以下配置: this

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">         <property name="dataSource" ref="myDataSource"/>         <!-- 映射jbpm4.4的實體配置文件 -->         <property name="mappingJarLocations">                <value>WEB-INF/lib/jbpm.jar</value>         </property>         <property name="hibernateProperties">           <value>             hibernate.dialect=org.hibernate.dialect.MySQL5Dialect             <!-- 自動建表 -->             hibernate.hbm2ddl.auto=update           </value>         </property>    </bean> <!-- jbpm4.4配置 -->      <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">               <property name="jbpmCfg" value="jbpm.cfg.xml"></property>      </bean>           <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine"/>
相關文章
相關標籤/搜索