Bootstrapping Camunda with Spring Boot – Minimal Configuration.

Creating and kicking off a Spring Boot application with embedded Camunda Engine, Task List, Cockpit, and Admin web applications is simple yet very useful for new or experienced Camunda developers when a fast and zero-configuration environment is needed.

The source code presented in this post may be found in this GitHub repository.

Camunda Web Apps Welcome Page

1. Creating A Maven Java Project

The easiest way to have Camunda running in your environment is to create a Maven project with Spring Boot. Let’s see what we will need in the following steps.

1.1 Create the project folder structure

my-app/
├─ src/
│  ├─ main/
│  │  ├─ java/
│  │  │  ├─ com/
│  │  │  │  ├─ my-camunda-app/
│  │  │  │  │  ├─ Application.java
│  │  ├─ resources/
│  │  │  ├─ application.yaml
│  │  │  ├─ process.bpmn
├─ pom.xml

1.2 Create the project folder structure

Create a basic pom.xml file and add into it the three following tags:

<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.5.4</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-bom</artifactId>
        <version>7.16.0</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>
 <dependencies>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
  </dependencies>
 <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.5.4</version>
      </plugin>
    </plugins>
  </build>

2. Create The Spring Boot Yaml Configuration

This file holds configurations passed to Spring Boot and Camunda engine. We will configure it with the most basic configurations: h2 as the database and basic authentication.

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

camunda.bpm.admin-user:
  id: demo
  password: demo

3. Create a Spring Boot Application Java class

This file is the main Spring Boot application class.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {

  public static void main(String... args) {
    SpringApplication.run(Application.class, args);
  }
}

4. Create a process.BPMN file

Download and install Camunda Modeler, create a simple executable process and save it into the resources folder.

5. Building And Running The Application

Open a command prompt, navigate into the project folder and run the following command. This will kick off the spring boot application.

mvn spring-boot:run

Now, open your browser at http://localhost:8080. You should be seeing the Camunda web apps login form on the screen. Provide user and password as you configured in the application.yaml file: username: demo; password: demo

After login in, you should be able to navigate through the 3 Camunda Web Apps: Tasklist, Cockpit, and Admin.

6. Conclusion

And that is it—a very simple Camunda bootstrapping with Spring Boot.

References

Building an Application with Spring Boot
Maven in 5 minutes
Get started with Camunda and Spring Boot

The source code presented in this post may be found at this GitHub repository.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts

CamundaCon 2021

https://vimeo.com/612969629/7be295de3d Processes, Cases, Projects, and Plans: Avoiding Common Automation Pitfalls A common pitfall for business process automation projects is

Read More