Springboot集成Camunda

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Springboot集成Camunda

LoneWalker、   2022-05-23 我要评论

一、匹配版本

基于Camunda 7.16.0 + Springboot 2.5.8

首先我们去官网找到camunda7.16对应的springboot版本。camunda官网

使用camunda流程引擎、web界面、Rest服务接口相应依赖如下:

流程引擎:camunda-bpm-spring-boot-starterRest服务接口:camunda-bpm-spring-boot-starter-restweb界面模块: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项目,引入相关的场景启动器

        <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:
  # 配置账户密码来访问Camunda自带的管理界面
  admin-user:
    id: demo
    password: demo
    firstName: Demo
  filter:
    create: All tasks
  #禁止自动部署resources下面的bpmn文件
  auto-deployment-enabled: false
  #禁止index跳转到Camunda自带的管理界面,默认true
  #    webapp:
  #      index-redirect-enabled: false

直接启动项目后,就可以看到数据库已经生成了49张表

ACT_RE_*:RE代表存repository。带有此前缀的表包含“静态”信息,例如流程定义和流程资源(图像、规则等)。

ACT_RU_*:RU代表runtime。这些是运行时表,包含流程实例、用户任务、变量、作业等的运行时数据。引擎仅在流程实例执行期间存储运行时数据,并在流程实例结束时删除记录。这使运行时表既小又快。

ACT_ID_*:ID代表identity。这些表包含身份信息,例如用户、组等。

ACT_HI_*:HI代表history。这些是包含历史数据的表,例如过去的流程实例、变量、任务等。

ACT_GE_*:GE代表 general一般数据,用于各种用例

总结

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们