我公司采用分布式敏捷架构zheng:https://gitee.com/shuzheng/zheng。不过,如果要让此架构支持activiti工作流,需要进行一定的配置。

一、打开zheng-common项目的pom.xml文件,添加activiti包。

[html] view plain copy
  1. <dependency>  
  2.     <groupId>org.activiti</groupId>  
  3.     <artifactId>activiti-engine</artifactId>  
  4.     <version>5.14</version>  
  5.   </dependency>  
  6.   
  7.   <dependency>  
  8.     <groupId>org.activiti</groupId>  
  9.     <artifactId>activiti-spring</artifactId>  
  10.     <version>5.14</version>  
  11.   </dependency>  
二、在zheng-rpc-service资源项目里添加activiti.cfg.xml文件。内容如下:

[html] view plain copy
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"  
  3.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.        xmlns:p="http://www.springframework.org/schema/p"  
  5.        xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"  
  6.        xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"  
  7.        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd  
  8.        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd  
  9.        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd  
  10.        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd  
  11.        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">  
  12.   
  13.     <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">  
  14.         <property name="activityFontName" value="微软雅黑"></property>  
  15.   
  16.         <property name="dataSource" ref="dataSource"></property>  
  17.         <property name="transactionManager" ref="transactionManager"></property>  
  18.         <!-- 建表策略 -->  
  19.         <property name="databaseSchemaUpdate" value="true"></property>  
  20.         <!-- 历史控制级别 -->  
  21.         <property name="history" value="full"></property>  
  22.     </bean>  
  23.   
  24.     <bean id="processEngineFactoryBean" class="org.activiti.spring.ProcessEngineFactoryBean">  
  25.         <property name="processEngineConfiguration" ref="processEngineConfiguration"></property>  
  26.     </bean>  
  27.   
  28.     <bean id="repositoryService" factory-bean="processEngineFactoryBean" factory-method="getRepositoryService"></bean>  
  29.     <bean id="runtimeService" factory-bean="processEngineFactoryBean" factory-method="getRuntimeService"></bean>  
  30.     <bean id="taskService" factory-bean="processEngineFactoryBean" factory-method="getTaskService"></bean>  
  31.     <bean id="historyService" factory-bean="processEngineFactoryBean" factory-method="getHistoryService"></bean>  
  32.     <bean id="formService" factory-bean="processEngineFactoryBean" factory-method="getFormService"></bean>  
  33.     <bean id="identityService" factory-bean="processEngineFactoryBean" factory-method="getIdentityService"></bean>  
  34.     <bean id="managementService" factory-bean="processEngineFactoryBean" factory-method="getManagementService"></bean>  
  35.   
  36. </beans>  


三、在applicationContext-jdbc.xml文件添加一行导入资源代码:

[html] view plain copy
  1. <import resource="activiti.cfg.xml"/>  

添加好后的示例如图所示:

让zheng支持activiti工作流

相关文章: