Spring 与 Activiti 集成

来源:互联网 发布:2016酒店行业数据分析 编辑:程序博客网 时间:2024/05/17 13:14

1,首先,基于MVN 搭建spring MVC项目(这里就不做说明了)。
2,集成Activiti
(1)添加必要的依赖包

    <!-- activity -->    <dependency>        <groupId>org.activiti</groupId>        <artifactId>activiti-engine</artifactId>        <version>5.21.0</version>    </dependency>    <dependency>        <groupId>org.activiti</groupId>        <artifactId>activiti-spring</artifactId>        <version>5.21.0</version>    </dependency>

(2) 在resources下添加 activiti.cfg.xml 文件

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"    xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:util="http://www.springframework.org/schema/util"    xmlns:websocket="http://www.springframework.org/schema/websocket"     xsi:schemaLocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd        http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket.xsd"    default-lazy-init="false">    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">        <property name="dataSource" ref="dataSource"></property>        <property name="transactionManager" ref="transactionManager"></property>        <property name="databaseSchemaUpdate" value="true"></property>        <property name="jobExecutorActivate" value="false"></property>    </bean>    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"></bean>    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">        <property name="processEngineConfiguration" ref="processEngineConfiguration"></property>    </bean>    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"></bean>    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"></bean>    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"></bean>    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"></bean>    <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService"></bean>    <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"></bean>    <bean id="formService" factory-bean="processEngine" factory-method="getFormService"></bean></beans>

到此,配置就完成了,启动tomcat,查看数据库中是否已经产生了若干表,如果有,则说明配置成功

0 0
原创粉丝点击