zoukankan      html  css  js  c++  java
  • Activity 与 springMvc相整合

    准备环境:

    springMvc框架及Activity所需要的jar:

    创建spring-activity.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:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
    default-lazy-init="true">

    <!-- 创建一个流程引擎的配置对象 -->
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <!-- 设置数据库schema的更新方式 -->
    <property name="databaseSchemaUpdate" value="false" />
    <!-- 是否启动jobExecutor -->
    <property name="jobExecutorActivate" value="false" />
    <!-- <property name="databaseSchema" value="ACT"/> -->
    <!-- <property name="deploymentResources">
    <list>
    <value>classpath:diagrams/MyProcess.bpmn</value>
    <value>classpath:diagrams/MyProcess.png</value>
    </list>
    </property> -->
    </bean>

    <!-- 创建一个流程引擎bean -->
    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
    </bean>

    <!-- 创建activiti提供的各种服务 -->
    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
    <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="formService" factory-bean="processEngine" factory-method="getFormService" />
    </beans>

    然后在web.xml加入:

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    classpath:spring/spring-activiti.xml
    </param-value>
    </context-param>

    启动就可以了。

    如果报默报错 spring-activity.xml 改成如下:

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <!-- 设置数据库schema的更新方式 -->
    <property name="databaseSchemaUpdate" value="true" />
    <!-- 是否启动jobExecutor -->
    <property name="jobExecutorActivate" value="false" />
    <property name="databaseSchema" value="ACT"/> 
    </bean>

  • 相关阅读:
    linux下网络排错与查看
    linux下判断网络是否连接
    Linux 下操作gpio(两种方法,驱动和mmap)
    Kernel 中的 GPIO 定义和控制
    springboot jpa 解决延迟加载问题
    Hibernate @OneToOne懒加载实现解决方案
    Hibernate缓存和懒加载的坑你知道多少?这5个简单问题回答不上来就不敢说会用hibernate
    Spring Boot JPA 懒加载
    Spring Boot中使用Spring-data-jpa让数据访问更简单、更优雅
    Spring Data Jpa 详解 (配置篇)
  • 原文地址:https://www.cnblogs.com/lingbing/p/7988238.html
Copyright © 2011-2022 走看看