Activiti工作流框架学习笔记(二)之springboot2.0整合工作流Activiti6.0
以前在工作当中做过不少与工作流Activiti有关的工作,当时都是spring集成activiti5.22的项目,现在回过头去看,其实版本已经稍微老了,因此,基于先前的工作经验,决定用较新版本的技术来重新梳理下以前接触过的技术。
决定用springboot2.0+Activiti6.0来做实践总结。
第一步,在springboot项目pom.xml文件引入相关依赖:
<!--Activiti 工作流-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>5.1.35</scope>
</dependency> <dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>6.0.0</version>
</dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.5</version>
</dependency>
第二步,建立Activiti的配置类
@Configuration
public class Activiticonfig { /**
* 流程实例类,启动流程时创建
* @return
*/
@Bean
public ProcessEngine processEngine(){
ProcessEngineConfiguration pro=ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
pro.setJdbcDriver("com.mysql.jdbc.Driver");
pro.setJdbcUrl("jdbc:mysql://localhost:3306/example?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=UTC&nullCatalogMeansCurrent=true");
pro.setJdbcUsername("root");
pro.setJdbcPassword("root");
//避免发布的图片和xml中文出现乱码
pro.setActivityFontName("宋体");
pro.setLabelFontName("宋体");
pro.setAnnotationFontName("宋体");
pro.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
return pro.buildProcessEngine();
} /**
* 仓库服务类,用于管理bpmn文件与流程图片
* @return
*/
@Bean
public RepositoryService repositoryService(){
return processEngine().getRepositoryService();
} /**
* 流程运行服务类,用于获取流程执行相关信息
* @return
*/
@Bean
public RuntimeService runtimeService(){
return processEngine().getRuntimeService();
} /**
* 任务服务类,用户获取任务信息
* @return
*/
@Bean
public TaskService taskService(){
return processEngine().getTaskService();
} /**
* 获取正在运行或已经完成的流程实例历史信息
* @return
*/
@Bean
public HistoryService historyService(){
return processEngine().getHistoryService();
} /**
* 流程引擎的管理与维护
* @return
*/
@Bean
public ManagementService managementService(){
return processEngine().getManagementService();
} /**
* 创建、更新、删除,查询群组和用户
* @return
*/
@Bean
public IdentityService identityService(){
return processEngine().getIdentityService();
} }
在springboot工程里简单加完这些配置后,启动项目,原以为可以正常生成Activi6.0工作流自带的28张表,但这时出现了一堆错误:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table 'example.act_ge_property' doesn't exist
### The error may exist in org/activiti/db/mapping/entity/Property.xml
### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntityImpl.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLSyntaxErrorException: Table 'example.act_ge_property' doesn't exist
出现这种问题主要是因为MySql的版本问题,在连接mysql的url后边加一个&nullCatalogMeansCurrent=true即可解决。
再次运行后,成功创建了28张Activiti自带的数据表——

接下来,将基于该搭建,对Activiti工作流引擎做更多操作实践。
Activiti工作流框架学习笔记(二)之springboot2.0整合工作流Activiti6.0的更多相关文章
- Spring框架学习笔记(4)——SSM整合以及创建Maven自定义模版
Spring+Spring MVC+MyBatis+Maven SSM整合的核心还是Spring+MyBatis的整合,回顾一下MyBatis操作数据库流程,我们是使用一个SQLSessionFact ...
- Activiti工作流框架学习(二)——使用Activiti提供的API完成流程操作
可以在项目中加入log4j,将logj4.properties文件拷入到src目录下,这样框架执行的sql就可以输出到到控制台,log4j提供的日志级别有以下几种: Fatal error war ...
- Dojo框架学习笔记<二>
一.dojo/dom 该模块定义了Dojo Dom API,主要有以下几种用法: 1.dom.byId();(相当于document.getElementById()) ①最直接的用 ...
- 集合框架学习笔记<二>
1.什么是ArrayList ArrayList就是传说中的动态数组,用MSDN中的说法,就是Array的复杂版本,它提供了如下一些好处: 动态的增加和减少元素 实现了ICollection和ILis ...
- semantic ui框架学习笔记二
评论组件 文档里的评论组件介绍的比较清晰.这里我就挑一个我喜欢的格式展示出来: <div class="ui comments"> <h3 class=" ...
- unittest框架学习笔记二之discover
coding=utf-8'''Created on 2018/3/29 author:star Project:discover测试用例''' import unittest,time,oslist= ...
- Yii框架学习笔记(二)将html前端模板整合到框架中
选择Yii 2.0版本框架的7个理由 http://blog.chedushi.com/archives/8988 刚接触Yii谈一下对Yii框架的看法和感受 http://bbs.csdn.net/ ...
- phalcon(费尔康)框架学习笔记
phalcon(费尔康)框架学习笔记 http://www.qixing318.com/article/phalcon-framework-to-study-notes.html 目录结构 pha ...
- [Firefly引擎][学习笔记二][已完结]卡牌游戏开发模型的设计
源地址:http://bbs.9miao.com/thread-44603-1-1.html 在此补充一下Socket的验证机制:socket登陆验证.会采用session会话超时的机制做心跳接口验证 ...
随机推荐
- jspdf + html2canvas 实现html转pdf (提高分辨率版本)
刚解决了html中某div块生成pdf的问题,热乎乎的,赶紧记录下 引入的js传送门: https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jsp ...
- 合并.ts文件 无需软件
cmd 命令直接输入: copy /b D:\temp\*.ts D:\new.ts D盘temp目录的ts文件 合并 并输出到 D盘 new.ts文件
- Java 读取Word中的脚注、尾注
本文介绍读取Word中的脚注及尾注的方法,添加脚注.尾注可以参考这篇文章. 注:本文使用了Word类库(Free Spire.Doc for Java 免费版)来读取,获取该类库可通过官网下载,并解压 ...
- iview中select搜索
https://www.jianshu.com/p/1c40d7cc440e https://www.cnblogs.com/yun1108/p/10967735.html https://blog. ...
- Vue项目二、vue-cli2.x脚手架搭建build文件夹及config文件夹详解
build文件夹下 build.js 'use strict' // js的严格模式 require('./check-versions')() // node和npm的版本检查 process.en ...
- 前端传json数组 ,后端的接收
前端传输: var updateGoodsId=$(this).val();//get id var updateGoodsPrice=$("#IngoodsPrice"+upda ...
- [IOI1994] 时钟 - 搜索
考虑九个安排在 \(3 \times 3\) 矩阵中的时钟,每个时钟只会指向 \(3,6,9,12\) 点.有 \(9\) 种操作方式,每种操作方式规定了其固定的操作对象集合,将这几个时钟都往后拨 \ ...
- JS反爬绕过思路之--谷歌学术镜像网链接抓取
首先,从问题出发: http://ac.scmor.com/ 在谷歌学术镜像网收集着多个谷歌镜像的链接.我们目标就是要把这些链接拿到手. F12查看源码可以发现,对应的a标签并不是我们想要的链接,而是 ...
- SSL/TLS 协议运行机制概述(一)
SSL/TLS 协议运行机制概述(一) SSL/TLS 发展史 1994年,NetScape 设计了SSL协议(Secure Sockets Layer) 1.0,未正式发布 1995年,NetSca ...
- 使用.Net Core编写命令行工具(CLI)
命令行工具(CLI) 命令行工具(CLI)是在图形用户界面得到普及之前使用最为广泛的用户界面,它通常不支持鼠标,用户通过键盘输入指令,计算机接收到指令后,予以执行. 通常认为,命令行工具(CLI)没有 ...
