JBPM4.0CR1和Spring的整合

前两天看到JBPM4.0c出CR1了,为之兴奋,马上下载了下来,直到这会才算整合成功,发布成功了流程。

跟了四个版本,发现自己还是没有完全理解JBPM,所以之前的整合都是野派路子。今天下午看到ronghao写的 《jBPM4与Spring的集成》,以及参考 http://www.slideshare.net/guest8d4bce/spring-integration-with-jbpm4,终于完美整合成功了。

其实jbpm的很多信息,都是通过jbpm.cfg.xml文件设置的,之前我整合的时候是不要这个文件的,所以总是发现很多地方不通畅。

当然有些地方还是根据自己的需要,修改了源代码,这个倒也不是很重要。把用到的配置文件贴出来,供大家参考。

beans
	<bean id="environmentFactory" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
		<constructor-arg value="config/jbpm.cfg.xml" />
	</bean>

	<bean id="processEngine" factory-bean="environmentFactory" factory-method="buildProcessEngine" />  
    
    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />  
    
    <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />  

	<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
	
	<bean id="managementService"  factory-bean="processEngine" factory-method="getManagementService" />

	<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
	
	<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />

config/jbpm.cfg.xml
<jbpm-configuration>
	<process-engine-context>
		<repository-service />
		<repository-cache />
		<execution-service />
		<history-service />
		<management-service />
		<identity-service />
		<task-service />
		<command-service>
			<retry-interceptor />
			<environment-interceptor />
			<spring-transaction-interceptor
				current="true" />
		</command-service>

		<deployer-manager>
			<jpdl-deployer />
		</deployer-manager>

		<script-manager default-expression-language="juel"
			default-script-language="juel" read-contexts="execution, environment, process-engine"
			write-context="">
			<script-language name="juel"
				factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
		</script-manager>

		<authentication />

		<id-generator />
		<types resource="jbpm.variable.types.xml" />
	</process-engine-context>

	<transaction-context>
		<repository-session />
		<db-session />
		<message-session />
		<timer-session />
		<history-session />
		<hibernate-session current="true" />
	</transaction-context>
</jbpm-configuration>

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