jbpm4.3 spring 整合
来源:互联网 发布:陈意涵长相知乎 编辑:程序博客网 时间:2024/04/28 20:26
查阅 jBPM Developers Guide 文档
集成Spring和jBPM的最简单方式是在你的jbpm.cfg.xml文件中导入 jbpm.tx.spring.cfg.xml:
<import resource="jbpm.tx.spring.cfg.xml" />
这个配置使用了一个事务管理器,它是定义在Spring配置中的。 从这个文件的内容开始吧,如果你需要了解jBPM-spring 的整合配置。
如果你是从一个已存在的配置开始,可以把standard-transaction-interceptor 替换为spring-transaction-interceptor。hibernate session需要使用属性current="true", 这取决于是否使用了spring中的'current session'策略。 而且,<transaction/>必须从transaction-context中删除,如果你希望 事务只由spring进行管理。 这会让jBPM从当前session中搜索,它应该是被spring提供的。
<process-engine-context> <command-service> <spring-transaction-interceptor /> ... </command-service> ... </process-engine-context> <transaction-context> ... <hibernate-session current="true"/> </transaction-context>
spring-transaction-interceptor默认会查找PlatformTransactionManager的实现, 通过类型在定义好的bean中查找。在有多个事务管理器的情况, 可以使用事务管理器的名称来指定使用哪一个, 可以这样使用拦截器:
<spring-transaction-interceptor transaction-manager="myTransactionManager" />
Spring集成提供了一个特殊的context,它会添加到context集合中, jBPM引擎会从中查找bean。 使用SpringContext,现在可以从Spring Application Context中获得bean。 jBPM流程引擎可以向下面这样配置在 spring的applicationContext.xml中:
<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" /><bean id="processEngine" factory-bean="springHelper"
factory-method="createProcessEngine" />
采用此种方式不建议这样获得服务
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
在创建repositoryService对象的时候createBean() 方法会循环调用repositoryService对象,出现循环调用。
可以这样延迟实例化Bean,但意义不大。
<bean id="repositoryService" factory-bean="processEngine"
factory-method="getRepositoryService"
depends-on="springHelper,processEngine" lazy-init="true"/>
org.jbpm.pvm.internal.processengine.SpringHelper 的代码
package org.jbpm.pvm.internal.processengine;import org.jbpm.api.ProcessEngine;import org.jbpm.pvm.internal.cfg.ConfigurationImpl;import org.springframework.beans.BeansException;import org.springframework.context.ApplicationContext;import org.springframework.context.ApplicationContextAware;/** * @author Joram Barrez */public class SpringHelper implements ApplicationContextAware { protected ApplicationContext applicationContext; protected String jbpmCfg = "jbpm.cfg.xml"; public void setJbpmCfg(String jbpmCfg) { this.jbpmCfg = jbpmCfg; } //获得Spring容器 ApplicationContext 拿到Spring的事物管理器,实际上是Hibernate的事物管理器 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } protected ProcessEngine createProcessEngine() { return new ConfigurationImpl() .springInitiated(applicationContext) .setResource(jbpmCfg) .buildProcessEngine(); } }
- jbpm4.3 spring 整合
- jbpm4.3整合spring 完整案例
- JBPM4整合Spring环境搭建
- SSJ整合jBPM4.3
- 【整合篇】JBPM4.4与Spring整合
- 关于JBPM4.4与Spring整合
- jbpm4.4 +Spring mvc 整合架构
- SSHJ:Spring整合Struts2、Hibernate、JBPM4
- JBPM4.4:Spring和JBPM整合
- jbpm4.3整合spring3.0
- spring 3与jbpm4.3在整合所遇到的问题,记录
- jbpm4.2与spring整合(2009-11-22 00:50:14)标签:jbpm4.2 spring it
- Spring和JBPM4.3集成
- jbpm4.3与ssh框架进行整合
- JBPM4.3整合spring2.5+hibernate3.3.2
- jbpm4整合struts2+spring2.5+hibernate3.3
- jBPM4.3与Spring3.0的整合
- SSH整合JBPM4.3心得与体会
- java 内存泄露的监控
- Informix ODBC 设置
- 浅记计算机系统结构、组成及实现之间的区别与关系
- ASP.NET中TextBox控件设置ReadOnly="true"后台取不到值
- IE显示画面慢的一个原因:临时的文件的容量设置过小
- jbpm4.3 spring 整合
- 论坛上的精华
- window.showModalDialog 传值运用
- 装饰模式(Decorate Mode) C和C++的实现
- 已婚女人对你的十种暗示
- 在低位优先的计算机中使用C++读取高位优先的二进制文件的方法
- HQL 多表查询返回需要的属性值放到一个list里面
- 老公和老婆的超经典智斗
- 值得用一辈子记住的话