Java_Activiti5_菜鸟也来学Activiti5工作流_之与Spring集成(三)

 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:context="http://www.springframework.org/schema/context"
 5     xmlns:tx="http://www.springframework.org/schema/tx"
 6     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 7         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
 8         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
 9     
10     <!-- 配置数据源 -->
11     <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
12         <property name="driverClass" value="com.mysql.jdbc.Driver"/>
13         <property name="url" value="jdbc:mysql://localhost:3306/db_activiti?useUnicode=true&amp;characterEncoding=utf-8"/>
14         <property name="username" value="root"/>
15         <property name="password" value="root"/>
16     </bean>
17 
18     <!-- 配置数据源事务管理器 -->
19     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
20         <property name="dataSource" ref="dataSource"/> <!-- 引用上面的数据源 -->
21     </bean>
22     
23     <!-- 配置流程引擎配置类 注意:这是用 org.activiti.spring.SpringProcessEngineConfiguration 这个类-->
24     <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
25         <property name="dataSource" ref="dataSource"/>
26         <property name="transactionManager" ref="transactionManager" />
27         <property name="databaseSchemaUpdate" value="true" />
28         <property name="jobExecutorActivate" value="false" />
29         <property name="createDiagramOnDeploy" value="false" /> <!-- 是否生成流程定义图片 -->
30     </bean>
31     
32     <!-- 配置流程引擎工厂 -->
33     <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
34         <property name="processEngineConfiguration" ref="processEngineConfiguration" />
35     </bean>
36     
37     <!-- 配置注入一些服务 -->
38     <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
39     <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"/>
40     <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
41     <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
42     <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
43     
44     <!-- 配置activiti的规则 -->
45     <bean id="activitiRule" class="org.activiti.engine.test.ActivitiRule">
46         <property name="processEngine" ref="processEngine" />
47     </bean>
48     
49 </beans>

 

posted @ 2015-09-07 15:15  冯孟活  阅读(757)  评论(0编辑  收藏  举报