jbpm集成spring使用步骤

1、安装jpdl插件到myeclipse。http://www.cnblogs.com/chuyuhuashi/archive/2012/03/27/2418841.html

2.下载jbpm4.4.把

J:\jbpm\jbpm-4.4\install\src\cfg\jbpm下的spring.jbpm.cfg复制到新项目中,改为jbpm.cfg.xml

新建hibernate.properties文件:

dataSource.password=root
dataSource.username=root
dataSource.databaseName=jbpmdb
dataSource.driverClassName=com.mysql.jdbc.Driver
dataSource.dialect=org.hibernate.dialect.MySQLInnoDBDialect
dataSource.serverName=localhost:3306
dataSource.url=jdbc:mysql://${dataSource.serverName}/${dataSource.databaseName}
dataSource.properties=user=${dataSource.username};databaseName=${dataSource.databaseName};serverName=${dataSource.serverName};password=${dataSource.password}
dataSource.hbm2ddl.auto=update

 applicationContext.xml文件:

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

<beans xmlns="http://www.springframework.org/schema/beans" 
  xmlns:aop="http://www.springframework.org/schema/aop"
  xmlns:context="http://www.springframework.org/schema/context" 
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

  <context:annotation-config />
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"  p:location="hibernate.properties"  p:ignoreUnresolvablePlaceholders="true"/>
  
  <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />

  <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />

  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingResources">
       <list>
            <value>jbpm.repository.hbm.xml</value>
            <value>jbpm.execution.hbm.xml</value>
            <value>jbpm.history.hbm.xml</value>
            <value>jbpm.task.hbm.xml</value>
            <value>jbpm.identity.hbm.xml</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${dataSource.dialect}</prop>
            <prop key="hibernate.hbm2ddl.auto">${dataSource.hbm2ddl.auto}</prop>
        </props>
    </property>
  </bean>

  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    <property name="dataSource" ref="dataSource" />
  </bean>

  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${dataSource.driverClassName}" />
    <property name="url" value="${dataSource.url}" />
    <property name="username" value="${dataSource.username}" />
    <property name="password" value="${dataSource.password}" />
  </bean>

</beans>

 3.测试用的流程test.jpdl.xml,test将作为jpdl的process的name

<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://jbpm.org/4.4/jpdl" name="test">
<start g="94,64,48,48" name="start1">
      <transition g="-52,-22" name="A" to="A"/>
   </start>
   <task assignee="A" g="73,195,92,52" name="A">
      <transition g="-52,-22" name="B" to="B"/>
   </task>
   <task assignee="B" g="266,192,92,52" name="B">
      <transition g="-40,-21" name="end" to="end1"/>
   </task>
   <end g="290,327,48,48" name="end1"/>
</process>
 

http://www.blogjava.net/pengo/archive/2010/01/04/308219.html

http://www.blogjava.net/wangxinsh55/archive/2011/07/24/354925.html

猜你喜欢

转载自doushini.iteye.com/blog/1705596