说在前面
最终会做一个开源项目,实现一些中国式审批流程功能以及讲解。点击直达
感兴趣的朋友点赞收藏
一、匹配版本
基于Camunda 7.16.0 + Springboot 2.5.8
首先我们去官网找到camunda7.16对应的springboot版本。camunda官网
使用camunda流程引擎、web界面、Rest服务接口相应依赖如下:
- 流程引擎:camunda-bpm-spring-boot-starter
- Rest服务接口:camunda-bpm-spring-boot-starter-rest
- web界面模块:camunda-bpm-spring-boot-starter-webapp
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>7.16.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>7.16.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>7.16.0</version>
</dependency>
相关属性配置可参考Springboot集成配置
二、相关配置
首先新建一个数据库
再新建一个Springboot项目,引入相关的场景启动器
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>7.16.0</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.3</version>
</dependency>
新建application.yml文件【注意修改数据库名,数据库用户名和密码等值】
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/snail?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 1234
application:
name: snail-workflow
camunda:
bpm:
filter:
create: All tasks
#禁止自动部署resources下面的bpmn文件
auto-deployment-enabled: false
直接启动项目后,就可以看到数据库已经生成了49张表。如果没有自动生成表,在数据库连接后加&nullCatalogMeansCurrent=true
- ACT_RE_*:RE代表存repository。带有此前缀的表包含“静态”信息,例如流程定义和流程资源(图像、规则等)。
- ACT_RU_*:RU代表runtime。这些是运行时表,包含流程实例、用户任务、变量、作业等的运行时数据。引擎仅在流程实例执行期间存储运行时数据,并在流程实例结束时删除记录。这使运行时表既小又快。
- ACT_ID_*:ID代表identity。这些表包含身份信息,例如用户、组等。
- ACT_HI_*:HI代表history。这些是包含历史数据的表,例如过去的流程实例、变量、任务等。
- ACT_GE_*:GE代表 general一般数据,用于各种用例
本文只集成了流程引擎。