Table of contents
Introduction: Today's technology is developing rapidly, and enterprises' needs for efficient management and automation of business processes are also growing. In this context, Spring Boot and Camunda7 have become two highly respected open source frameworks. As a rapid development Java framework, Spring Boot provides tools and technologies to simplify enterprise-level application development, while Camunda7 serves as a process engine to help enterprises model, execute and monitor business processes. Integrating Spring Boot with Camunda7 not only makes full use of Spring Boot's convenient development features, but also enables flexible business process management and optimization. This article will briefly introduce how to use Spring Boot to integrate with Camunda7, and provide readers with a simple and easy-to-operate guide to integrate these two frameworks. Whether you are a Java developer or a professional interested in business process management, this article will bring you valuable knowledge and practical experience.
Of course, you can also directly read the official camunda7 English guide and start integrating directly. Official website address: https://docs.camunda.org/manual/latest/
1. Results display
The picture above is a simple process. If you want to build this process, you need to use BPMN drawing. Readers can download it directly from the official website Camunda modeler
. (Portal: https://camunda.com/download/modeler/#modeler)
If spring boot + camunda is successfully built, you can access the local web interface. After registering and logging in, there will be an interface as shown below:
click Deployments
the tab , the deployed bpmn
process information will appear, as shown in the figure below:
OK, here you can simply understand Spring boot + Camunda7
the web app background management program provided by the Spring boot official website after integration.
2. Environment preparation
Java version: jdk11
mysql version: 8.0.0+
Camunda version: 7.19
Spring boot version: 2.7.6
Since I like to use it in my projects groovy
, there are alsogroovy: 3.0.4+
3. Project construction
3.1 Project structure
The project file structure is shown in the figure below:
My project was groovy + spring boot + gradle
built using , so you can groovy
convert to java
(Tip: subsequent publications are written groovy
in , in fact, the syntax of groovy
and Java
is mostly the same), gradle
to maven
.
3.2 Introducing Camunda dependency
gradle introduces:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.codehaus.groovy:groovy'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter:7.19.0'
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:7.19.0'
implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:7.19.0'
}
maven introduces:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>7.19.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>7.19.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>7.19.0</version>
</dependency>
</dependencies>
3.3 Start the spring boot program
spring boot configuration file: application.yaml
server:
port: 8080
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/camunda719
password: root
username: root
Start the spring boot program, the startup class is as follows:
package com.lm.lmcamunda7
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
@SpringBootApplication
@EnableProcessApplication
class Application {
static void main(String[] args) {
def run = SpringApplication.run(Application, args)
println run.getBeanDefinitionNames().toArrayString()
}
}
3.4 Start the web app program
After starting, visit localhost:8080, as shown in the figure below:
You can then operate.
The next article introduces the database ER structure of camunda. portal