jbpm+Spring


 

jbpm.cfg.xml文件配置 :工程src目录下。

 

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

<jbpm-configuration>

<import resource="jbpm.default.cfg.xml" />
<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" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />

<process-engine-context>
    <string name="spring.cfg" value="applicationContext-*.xml" /><!--这里写spring配置文件路径-->
</process-engine-context>

</jbpm-configuration>

 

 

 在applicationContext-jbpm.xml配置文件 下注入jbpm引擎:

<?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"
xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<!-- 集成jbpm
-->
<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />

<bean id="processEngine" factory-bean="springHelper"
   factory-method="createProcessEngine" />
<!-- spring -->
<bean id="dataSource"
   class="org.apache.commons.dbcp.BasicDataSource">
   <property name="driverClassName"
    value="oracle.jdbc.driver.OracleDriver">
   </property>
   <property name="url"
    value="jdbc:oracle:thin:@localhost:1521:oracle服务名">
   </property>
   <property name="username" value="登录名"></property>
   <property name="password" value="密码"></property>
   <property name="maxActive" value="100"/>
     <property name="maxWait" value="1000"/>
     <property name="poolPreparedStatements" value="true"/>
     <property name="defaultAutoCommit" value="true"/>
</bean>
<bean id="sessionFactory"
   class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
   <property name="dataSource">
    <ref bean="dataSource" />
   </property>
   <property name="hibernateProperties">
    <props>
     <prop key="hibernate.dialect">
      org.hibernate.dialect.Oracle9Dialect
     </prop>
     <!-- prop key="hibernate.show_sql">
      true
     </prop> -->
      <prop key="hibernate.hbm2ddl.auto">
          update<!--第一次使用可以用create或delete 自动创建或删除数据库-->
       </prop>
        <prop key="hibernate.jdbc.batch_size">0</prop>
       
    </props>
   </property>
   <property name="mappingResources">
    <list>
     <!--jbpm要求的文件-->
     <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></bean>

bean


 

public class OneBean  {

private ProcessEngine processEngine;
public void setProcessEngine(ProcessEngine processEngine) {
   this.processEngine = processEngine;
}

private RepositoryService repositoryService = null;// 存储服务
private ProcessInstance processInstance = null; // 流程实例
private ExecutionService executionService = null; // 执行服务
private TaskService taskService = null; // 任务服务

//初始化

public void init() {
   repositoryService = processEngine.getRepositoryService();
   executionService = processEngine.getExecutionService();
   taskService = processEngine.getTaskService();
}

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值