jbpm4.4和spring 多事务处理

    在多事务管理器的项目中正常配置jbpm4.4和spring 集成后可以正常注入processEngine 但是始终一下 [WARN]

  Multiple Spring beans found for type interface org.springframework.transaction.PlatformTransactionManager returning the first one found

 经过各种搜索,了解到是jbpm多事务处理中无法知道使用哪个事务,会报上面警告,之后会默认实例化第一个事故管理器、

 如果想使用其他个事务管理的话,可以指定的。怎么指定,官方指南也写了。只要指定transaction-manager即可。 就是将jbpm.jar包中的jbpm.tx.spring.cfg.xml提出来放在项目下,在spring-jbpm4.cfg.xml中指定

写道
<import resource="spring/jbpm.tx.spring.cfg.xml" />

 引入jbpm.tx.spring.cfg.xml 配置文件

jbpm.tx.spring.cfg.xml 中的具体配置为

 

写道

 

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

<jbpm-configuration spring="enabled">

<process-engine-context>

<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<spring-transaction-interceptor policy="requiresNew" />
</command-service>

<!-- Default command service has a Spring transaction interceptor-->
<command-service name="txRequiredCommandService">
<retry-interceptor />
<environment-interceptor />
  <spring-transaction-interceptor  current="true" transaction-manager="transactionManager"/>  //  transactionManager为你所指定的事务管理器
<spring-transaction-interceptor />
</command-service>

</process-engine-context>

<transaction-context>
<transaction type="spring" />
<hibernate-session current="true" />
</transaction-context>

</jbpm-configuration>

 springHelper 的配置为

 

<bean id="springHelper"  class="org.jbpm.pvm.internal.processengine.SpringHelper">
		<property name="jbpmCfg" value="spring/spring-jbpm4.cfg.xml" />		
	</bean>
<bean id="processEngine" factory-bean="springHelper"
		factory-method="createProcessEngine" />

 

 

你可能感兴趣的:(spring,jbpm)