当前位置: 首页 > news >正文

springMVC集成activiti-explorer5.22(一)

1.搭建springMVC环境,此处就不在多说,略过...

2.解压缩activiti-explorer文件,复制activiti-explorer目录下面的diagram-viewer、editor-app、modeler.html三个文件到项目中,如图:

springMVC集成activiti-explorer5.22(一)

3.复制activiti-explorer项目classes目录下的stencilset.json文件到你的项目中,如图:

springMVC集成activiti-explorer5.22(一)

4.复制到项目中的目录结构如下(可自定义到其他位置),如图:

springMVC集成activiti-explorer5.22(一)

5.编写activiti的配置文件,并引入到spring的配置文件中启动,代码如下:

<?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.1.xsd
        http://www.springframework.org/schema/context   http://www.springframework.org/schema/context/spring-context-4.1.xsd
        http://www.springframework.org/schema/mvc   http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">  
    <!-- 在线编辑器配置开始 -->  
    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>  
    <!-- 在线编辑器配置结束 -->  
    <!-- activiti 配置开始 -->  
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> 
        <!-- 注入数据库连接池 -->  
        <property name="dataSource" ref="dataSource"/>  
        <!-- 配置事物管理器 -->  
        <property name="transactionManager" ref="transactionManager"/>  
        <!-- 自动构建数据库表,设置value="true",第一次启动建表;设置value="drop-create",每次启动时建新表 -->  
        <property name="databaseSchemaUpdate" value="true"/>  
        <!--激活Timer和异步消息的线程的组件,即activiti的定时扫描任务,默认:true,不使用的话建议关掉 -->  
        <property name="jobExecutorActivate" value="false"/>  
        <!-- 生成流程图的字体 -->  
        <property name="activityFontName" value="宋体"/>  
        <property name="labelFontName" value="宋体"/>  
        <property name="annotationFontName" value="宋体"/>  
        <!-- UUID作为主键生成策略 -->  
        <!-- <property name="idGenerator" ref="uuidGenerator" /> -->  
        <!-- 自动部署,只有流程数据库中没有和自动部署的流程定义相同的记录才会部署 -->  
        <property name="deploymentResources"> 
            <list> 
                <value>classpath*:/deployments/*.bpmn</value>  
                <value>classpath*:/deployments/*.png</value> 
            </list> 
        </property> 
    </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="formService" factory-bean="processEngine" factory-method="getFormService"/>  
    <!-- 提供基础的用户管理以及身份认证 -->  
    <bean id="IdentityService" factory-bean="processEngine" factory-method="getIdentityService"/>  
    <!-- activiti 配置结束 --> 
</beans>

6.spring核心配置文件如下:

<?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:jdbc="http://www.springframework.org/schema/jdbc"
 xmlns:jee="http://www.springframework.org/schema/jee"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:util="http://www.springframework.org/schema/util"
 xmlns:task="http://www.springframework.org/schema/task"
 xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
     http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd">  
    <!-- 扫描activiti在线编辑器的跳转@RestController -->  
    <context:component-scan base-package="com" use-default-filters="false"> 
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> 
    </context:component-scan>  
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> 
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>  
        <property name="url" value="jdbc:mysql://localhost:3306/activiti_test"/>  
        <property name="username" value="root"/>  
        <property name="password" value="root"/>  
        <property name="defaultAutoCommit" value="false"/> 
    </bean>  
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 
        <property name="dataSource" ref="dataSource"/> 
    </bean>  
    <!-- 配置 Annotation 驱动,扫描@Transactional注解的类定义事务  -->  
    <!-- <tx:annotation-driven transaction-manager="transactionManager" /> -->  
    <!-- 引入SpringMVC配置文件 -->  
    <import resource="applicationActiviti.xml"/> 
</beans>

7.springMVC的配置文件中不要忘记扫描controller,springMVC的配置(这里只贴必须配置,如需扩展请根据自己情况添加)如下:

<?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.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">  
    <!-- 1.启动注解,注册服务,如验证框架、全局类型转换器-->  
    <mvc:annotation-driven/>  
    <!-- 2.启动自动扫描,只加载controller的时候,不加载service,因为此时事物并未生效,若此时加载了service,那么事物无法对service进行拦截 -->  
    <context:component-scan base-package="com.hello"/>  
    <context:component-scan base-package="com.rest.editor"/>  
    <!-- 3.配置视图解析器 -->  
    <!-- 对转向视图的路径解析,在请求时对视图名称添加前后缀 -->  
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
        <property name="prefix" value="/views/"/>  
        <property name="suffix" value=".jsp"/>  
        <property name="contentType" value="text/html;charset=UTF-8"/> 
    </bean>  
    <!-- 4.对静态资源文件的访问, 将无法mapping到Controller的path交给default servlet handler处理 -->  
    <!-- 执行顺序是2147483646 -->  
    <mvc:default-servlet-handler/> 
</beans>

8.web.xml文件就不贴了,根据自己项目情况配置就好

9.至此,集成activiti-explorer的基本工作已经做好

转载于:https://blog.51cto.com/1197822/2157711

相关文章:

  • freebsd为网卡设置别名
  • KVM命令集管理虚拟机
  • ORA-38301:can not perform DDL/DML Over Object in Recycle Bin 11.2.0.4
  • 实验:CentOS下构建私有CA
  • startActivityForResult()的用法(超好用啊)
  • [MongoDB]------windos下的安装部署与基础使用
  • JS小技巧
  • 【研究任务】热迁移方式——pre-copy、post-copy和x-multifd
  • 创建用于自定义SharePoint解决方案部署的Visual Studio项目
  • JavaScript中的对象个人分享
  • Python数据结构
  • Discuz!X3.1 全新安装图文教程
  • 关于Solr的使用总结的心得体会
  • paip.语义分析--单字词形容词表180个
  • vue格式化快捷键设置
  • 时间复杂度分析经典问题——最大子序列和
  • 2018以太坊智能合约编程语言solidity的最佳IDEs
  • ES6简单总结(搭配简单的讲解和小案例)
  • exif信息对照
  • Flannel解读
  • maven工程打包jar以及java jar命令的classpath使用
  • Median of Two Sorted Arrays
  • node和express搭建代理服务器(源码)
  • rc-form之最单纯情况
  • RedisSerializer之JdkSerializationRedisSerializer分析
  • 浮动相关
  • 聊聊directory traversal attack
  • 软件开发学习的5大技巧,你知道吗?
  • 移动端唤起键盘时取消position:fixed定位
  • ​草莓熊python turtle绘图代码(玫瑰花版)附源代码
  • ​创新驱动,边缘计算领袖:亚马逊云科技海外服务器服务再进化
  • # Java NIO(一)FileChannel
  • %@ page import=%的用法
  • (003)SlickEdit Unity的补全
  • (13)Hive调优——动态分区导致的小文件问题
  • (3)选择元素——(17)练习(Exercises)
  • (MATLAB)第五章-矩阵运算
  • (附源码)spring boot公选课在线选课系统 毕业设计 142011
  • (附源码)springboot高校宿舍交电费系统 毕业设计031552
  • (每日持续更新)信息系统项目管理(第四版)(高级项目管理)考试重点整理 第13章 项目资源管理(七)
  • (四)库存超卖案例实战——优化redis分布式锁
  • (一)硬件制作--从零开始自制linux掌上电脑(F1C200S) <嵌入式项目>
  • (转)linux 命令大全
  • (总结)Linux下的暴力密码在线破解工具Hydra详解
  • .axf 转化 .bin文件 的方法
  • .babyk勒索病毒解析:恶意更新如何威胁您的数据安全
  • .NET MVC 验证码
  • .NET Remoting学习笔记(三)信道
  • .NET/C# 异常处理:写一个空的 try 块代码,而把重要代码写到 finally 中(Constrained Execution Regions)
  • .net与java建立WebService再互相调用
  • .Net中ListT 泛型转成DataTable、DataSet
  • .vollhavhelp-V-XXXXXXXX勒索病毒的最新威胁:如何恢复您的数据?
  • /proc/stat文件详解(翻译)
  • @Autowired和@Resource装配
  • @kafkalistener消费不到消息_消息队列对战之RabbitMq 大战 kafka