jbpm4.4+spring3 整合

[color=red]-----使用jbpm4.4自身提供的factortBean[/color]
[color=green]<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" >
<property name="jbpmCfg" value="jbpm.cfg.xml"></property>
</bean>[/color]
[color=red]-----配置sessionFactory,包括jbpm本身的对象操作和用户自带的dataSource[/color]

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
[color=red]事务处理[/color]
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.bpm.service.*.*(..))" id="txPointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
</aop:config>

[color=red]自定义Dao,注入processEngine与session[/color]
<bean id="commonDao" class="com.bpm.dao.CommonDao">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="processEngine" ref="processEngine"/>
</bean>
[color=red]数据源[/color]
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@172.17.250.82:1521:EIMP" />
<property name="username" value="jbpm" />
<property name="password" value="jbpm" />
<property name="maxActive" value="50" />
<property name="initialSize" value="1" />


<!-- 超时等待时间以毫秒为单位 -->

<property name="maxWait" value="60000" />
<property name="maxIdle" value="20" />
<property name="minIdle" value="3" />
<!-- 是否自动回收超时连接 -->
<property name="removeAbandoned" value="true" />
<!-- 超时时间 -->
<property name="removeAbandonedTimeout" value="180" />

</bean>
以上是spring文件的主要配置,然后自定义一个jbpm.tx.spring.cfg.xml文件,添加语句 <transaction-context type="spring" />到jbpm.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>
<command-service name="txRequiredCommandService">
<retry-interceptor />
<environment-interceptor />
<spring-transaction-interceptor current="true" />
</command-service>

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

</jbpm-configuration>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值