Quick Start: Integrate Camunda Workflow Engine with Spring Boot

Learn how to set up and integrate the Camunda BPMN 2.0 workflow engine into a Spring Boot application, covering project initialization, Maven dependencies, configuration files, creating a simple user task process, and testing the workflow via Camunda’s web interface.

Programmer DD
Programmer DD
Programmer DD
Quick Start: Integrate Camunda Workflow Engine with Spring Boot

Camunda Overview

Camunda is a flexible workflow and process automation framework. Its core is a native BPMN 2.0 engine that runs on the Java Virtual Machine and can be embedded in any Java application or runtime container.

Official website: https://www.camunda.org/

Getting started docs: https://docs.camunda.org/get-started/

Integrating Camunda

Below is a step‑by‑step guide.

Preparation

Use Camunda Automation Platform 7 Initializr (https://start.camunda.com/) to generate a project.

Configure package name, admin user, and click Generate Project to download the project.

Unzip the downloaded project and open it with IntelliJ IDEA.

Edit pom.xml to add Camunda dependencies:

<dependency>
    <groupId>org.camunda.connect</groupId>
    <artifactId>camunda-connect-core</artifactId>
</dependency>

<dependency>
    <groupId>org.camunda.bpm</groupId>
    <artifactId>camunda-engine-plugin-connect</artifactId>
</dependency>

Because the Initializr uses Spring Boot 3.1, you may need to downgrade by adjusting dependencyManagement in pom.xml:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.6.4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-bom</artifactId>
            <version>7.15.0</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

Open application.yaml and configure the datasource and admin user:

spring.datasource.url: jdbc:h2:file:./camunda-h2-database

camunda.bpm.admin-user:
  id: transduck
  password: 111111
spring.datasource.url

: database used by the workflow engine (adjust for production). camunda.bpm.admin-user: admin account credentials.

Create a Simple Workflow

The workflow will request two inputs (name and message) and pass them to a service that creates a message output.

Model class:

public class model {
    private String message;
    private String name;

    public model() {}

    public String getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    @Override
    public String toString() {
        return "" + message + ", " + name;
    }
}

Controller to receive the message:

@RequestMapping("/")
@RestController
public class controller {

    Logger logger = Logger.getLogger(this.getClass().getName());

    @PostMapping("/message")
    public model createMessage(@RequestBody model model) {
        logger.info("-------Message Creator Initialized-------");
        model m = new model();
        m.setMessage(model.getMessage());
        m.setName(model.getName());
        logger.info("Message created --> " + m.toString());
        return m;
    }
}

Open resources/process.bpmn in Camunda Modeler to design the diagram.

Use a User Task to collect the name and message, then a Service Task to call the REST endpoint.

Configure the form fields “name” and “message” in the Form tab.

Add a Service Task, switch to the Connector tab, and set the HTTP details to call the endpoint.

Connect the User Task to the Service Task and then to the End Event.

Run and Test

Start the Spring Boot application in debug mode and open http://localhost:8080/. Log in with the admin credentials defined in application.yaml.

Navigate to the Tasklist, add a simple filter, and start the process.

Fill the form, claim the task, and complete it. The Service Task will execute and you should see the message output in the console.

Conclusion

This article demonstrated the complete steps to create a simple workflow using Spring Boot and Camunda.

JavaworkflowBPMNSpring BootCamunda
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.