Spring Boot2 集成 Camunda7 -(1)

发布时间 2023-11-29 15:00:25作者: 快乐随行

Camunda 是基于JAVA 语言开发的工作流引擎。Camunda流程引擎分社区版和企业版,社区版实际上是开源版,是Apache2.0协议,企业版实际上是商业收费版本,需要购买授权才能使用。

目前Camunda7和8版本并行更新,国内需要私有化部署流程引擎的用户建议选择camunda7,大部分组件开源,可免费使用,技术生态较好,程序员上手容易。如果对流程自动化和高并发有显著需求的客户,可以考虑选择camunda8,但需要大量扩展定制开发,对技术团队能力要求较高。参考:开源流程引擎camunda7与camunda8如何选择

一、Spring Boot 集成

Camunda Engine 可以使用提供的 Spring Boot starters 在 Spring Boot 应用程序中使用。这些 starters 将预先配置 Camunda process engine、REST API和 Web 应用程序,这样它们就可以方便地用于独立的流程应用程序。

若要启用 Camunda Platform 自动配置, 在 pom.xml 添加一下依赖:

<dependency>
  <groupId>org.camunda.bpm.springboot</groupId>
  <artifactId>camunda-bpm-spring-boot-starter</artifactId>
  <version>7.19.0</version>
</dependency>

这将增加 Camunda engine v.7.19.0 到您的依赖。

其他可以使用的 starters 有:

  • Rest服务接口:camunda-bpm-spring-boot-starter-rest
  • web界面模块:camunda-bpm-spring-boot-starter-webapp
  • camunda-bpm-spring-boot-starter-external-task-client

二、兼容性版本

Camunda Spring Boot Starte 的每个版本都绑定到 Camunda 平台和 Spring Boot的特定版本。Camunda 只推荐(并支持)这些默认的组合。在生产中使用之前,必须对其他组合进行彻底测试。

注意
从7.13.0版本开始,Camunda平台及其兼容的 Spring Boot Starter 总是共享相同的版本。
7.20以后版本需要Spring Boot3以后版本匹配。
以下表格来源于7.2.0官网文档

Spring Boot Starter version Camunda Platform version Spring Boot version
1.0.0* 7.3.0 1.2.5.RELEASE
1.1.0* 7.4.0 1.3.1.RELEASE
1.2.0* 7.5.0 1.3.5.RELEASE
1.2.1* 7.5.0 1.3.6.RELEASE
1.3.0* 7.5.0 1.3.7.RELEASE
2.0.0** 7.6.0 1.4.2.RELEASE
2.1.x** 7.6.0 1.5.3.RELEASE
2.2.x** 7.7.0 1.5.6.RELEASE
2.3.x 7.8.0 1.5.8.RELEASE
3.0.x 7.9.0 2.0.x.RELEASE
3.1.x 7.10.0 2.0.x.RELEASE
3.2.x 7.10.0 2.1.x.RELEASE
3.3.1+ 7.11.0 2.1.x.RELEASE
3.4.x 7.12.0 2.2.x.RELEASE
7.13.x
7.13.3+***
7.13.x
7.13.3+
2.2.x.RELEASE
2.3.x.RELEASE
7.14.x
7.14.2+***
7.14.x
7.14.2+
2.3.x.RELEASE
2.4.x
7.15.x
7.15.3+***
7.15.x
7.15.3+
2.4.x
2.5.x
7.16.x
7.16.3+***
7.16.x
7.16.3+
2.5.x
2.6.x
7.17.x
7.17.2+***
7.17.x
7.17.2+
2.6.x
2.7.x
7.18.x
7.19.x
7.18.x
7.19.x
2.7.x
7.20.x 7.20.x 3.1.x

*对于这些版本,请使用以下 Maven 坐标:

<dependency>
  <groupId>org.camunda.bpm.extension</groupId>
  <artifactId>camunda-bpm-spring-boot-starter</artifactId>
  <version>1.x</version> <!-- set correct version here -->
</dependency>

**对于这些版本,使用下列 Maven 坐标:

<dependency>
  <groupId>org.camunda.bpm.extension.springboot</groupId>
  <artifactId>camunda-bpm-spring-boot-starter</artifactId>
  <version>2.x</version> <!-- set correct version here -->
</dependency>

***对于这些版本,所有列出的 Spring Boot 版本都是支持的,而最老的版本默认使用。如果您想使用更新的支持版本,请配置 dependencyManagement 在你的应用中,例如。使用 Maven 时添加以下内容:

<dependencyManagement>
  <dependencies>
  ...
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-dependencies</artifactId>
      <version>2.x.y.RELEASE</version> <!-- set correct version here -->
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  ...
  </dependencies>
</dependencyManagement>