以前在工作当中做过不少与工作流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的更多相关文章

  1. Spring框架学习笔记(4)——SSM整合以及创建Maven自定义模版

    Spring+Spring MVC+MyBatis+Maven SSM整合的核心还是Spring+MyBatis的整合,回顾一下MyBatis操作数据库流程,我们是使用一个SQLSessionFact ...

  2. Activiti工作流框架学习(二)——使用Activiti提供的API完成流程操作

    可以在项目中加入log4j,将logj4.properties文件拷入到src目录下,这样框架执行的sql就可以输出到到控制台,log4j提供的日志级别有以下几种: Fatal  error  war ...

  3. Dojo框架学习笔记<二>

    一.dojo/dom    该模块定义了Dojo Dom API,主要有以下几种用法:    1.dom.byId();(相当于document.getElementById())    ①最直接的用 ...

  4. 集合框架学习笔记<二>

    1.什么是ArrayList ArrayList就是传说中的动态数组,用MSDN中的说法,就是Array的复杂版本,它提供了如下一些好处: 动态的增加和减少元素 实现了ICollection和ILis ...

  5. semantic ui框架学习笔记二

    评论组件 文档里的评论组件介绍的比较清晰.这里我就挑一个我喜欢的格式展示出来: <div class="ui comments"> <h3 class=" ...

  6. unittest框架学习笔记二之discover

    coding=utf-8'''Created on 2018/3/29 author:star Project:discover测试用例''' import unittest,time,oslist= ...

  7. Yii框架学习笔记(二)将html前端模板整合到框架中

    选择Yii 2.0版本框架的7个理由 http://blog.chedushi.com/archives/8988 刚接触Yii谈一下对Yii框架的看法和感受 http://bbs.csdn.net/ ...

  8. phalcon(费尔康)框架学习笔记

    phalcon(费尔康)框架学习笔记 http://www.qixing318.com/article/phalcon-framework-to-study-notes.html 目录结构   pha ...

  9. [Firefly引擎][学习笔记二][已完结]卡牌游戏开发模型的设计

    源地址:http://bbs.9miao.com/thread-44603-1-1.html 在此补充一下Socket的验证机制:socket登陆验证.会采用session会话超时的机制做心跳接口验证 ...

随机推荐

  1. vue+element 表单封成组件(2)

    今天我们继续把时间选择器,多选框和单选框加上 父组件(在昨天的基础上增加): <template> <el-form :model="ruleForm" ref= ...

  2. HTTP协议详解(深入理解)

    版权声明:本文为CSDN博主「有抱负的小狮子」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/weixin_ ...

  3. JZOJ 5326. LCA 的统计 (Standard IO)

    5326. LCA 的统计 (Standard IO) Time Limits: 1000 ms Memory Limits: 131072 KB Description Input Output S ...

  4. JZOJ 5305. 【NOIP2017提高A组模拟8.18】C (Standard IO)

    5305. [NOIP2017提高A组模拟8.18]C (Standard IO) Time Limits: 1000 ms Memory Limits: 131072 KB Description ...

  5. 第一篇博客 C+++知识点总结一

    1.成员 1.比较特殊的成员类型:protected. 保护成员在本类中和private类型的成员作用一模一样.区别在于保护成员可以由本类的派生类的成员函数访问,但是私有成员在其派生类中无法访问. 2 ...

  6. 轻量级MVC框架(自行开发)

    源码及demo: https://github.com/killallspree/myFrame/

  7. xpath提取标签和内容

    转:https://segmentfault.com/q/1010000012110138/a-1020000012113020 <div> <table> <tr> ...

  8. (转)GNU风格ARM汇编语法指南(非常详细)1

    原文地址:http://zqwt.012.blog.163.com/blog/static/120446842010111481551809/ 汇编源程序一般用于系统最基本的初始化:初始化堆栈指针.设 ...

  9. ssh 公钥 下载选择的时候 下拉选择 ssh 然后 git clone

    ssh 公钥 下载选择的时候 下拉选择 ssh 然后 git clone

  10. 0402数据放入集合进行查询-Java(新手)

    JDBC工具类: package cn.Wuchang.zyDome; import java.sql.*; public class JDBCUtils { private static final ...