zoukankan      html  css  js  c++  java
  • jBPM4.4与Spring整合

      与Spring的整合很简单:

      1)把事务交给Spring管理。

      2)通过Spring获取流程引擎ProcessEngine。

      在项目的src目录下添加jbpm.cfg.xml文件:

    <?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>

      

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

     <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"/>

      

      当然jbpm4.4的jar包也要拷贝到项目路径,注意一些jar包的冲突。

      

      

  • 相关阅读:
    获取web应用路径 // "/" 表示class 根目录
    C++ Knowledge series Inheritance & RTTI & Exception Handling
    ATL
    GCC & Maker
    NoSQL(Not Only SQL)
    ECMAScript Regex
    C++ Knowledge series Conversion & Constructor & Destructor
    Cloud Computing
    C++ Knowledge series STL & Const
    Java Knowledge series 7
  • 原文地址:https://www.cnblogs.com/luxh/p/2624153.html
Copyright © 2011-2022 走看看