Centurion, South Africa info@code2bits.com On Request

How to Create a Camunda BPM Spring Boot Application

This post contains a step-by-step guide on how to create a Camunda BPM Runtime in a Spring Boot application. Camunda BPM is an open-source workflow and decision automation platform.

Getting Started

The following list defines the technologies and libraries I used to implement the sample code:

Code Example

The code example can be downloaded from Github from the button below. After you have downloaded the code onto your machine, you can either work through the guide step-by-step to understand the example or jump to Step 5:Compile & Run The Application section to get the example up and running.

Download Code

Step 1: Use the Spring Initializr

Use the Spring Initializr website to assist you in generating a Spring Boot application. Open the following URL in a browser and complete the form to bootstrap your application.

Step 2: Update the Project Object Model (POM)

The Project Object Model (POM) is an XML file that contains information about the project and configuration details. The pom.xml file is used by Maven to build the project. Add the Camunda dependency to your Project Object Model.

<project>
    ...
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </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-webapp</artifactId>
            <version>3.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
    </dependencies>
    ...
</project>

To view the complete pom.xml file, please use the following link.

Step 3: View the default SimpleCamundaBpmApplication class

The Camunda BPM Spring Boot application is implemented by a class called SimpleCamundaBpmApplication. The class contains the @SpringBootApplication annotation that enables the spring boot auto configuration mechanism, enables the component scan on the packages and allow to register extra beans in the context.

@SpringBootApplication
public class SimpleCamundaBpmApplication {

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

Step 4: Configure the Camunda Spring Boot Application

The properties and configuration of the Spring Boot Application can be found in the application.yaml file within the src/main/resources folder. To startup your Camunda BPM Spring Boot application, you need to set some properties to allows you access. The complete set of properties for Camunda can be found here.

The properties to configure your admin-user are listed below:

camunda.bpm:
  admin-user:
    id: starlord
    password: knowhere
    firstName: Peter
  filter:
    create: All tasks

Step 5: Compile and Run the Application

Use the following command to compile the Java application making use of maven.

Build Application

$ mvn clean install

After you have successfully built the Camunda BPM Spring Boot application, the compiled artifact can be found in the target directory. There are several ways to run the Java Application. You can use either of the two commands below to start the Camunda BPM Spring Boot Application.

Run Application

$ java -jar target/SimpleCamundaBPM-0.0.1-SNAPSHOT.jar
$ maven spring-boot:run

View Camunda Admin Console

To view the Camunda Admin Console, type the following url in your browser while the application is running. You will be prompted with the login screen.

After you have typed the above URL in a browser while the application is running, you will be prompted with the login screen. The image display the default settings for the H2 console and will allow you to login withou a password.

Type the Username and Password you set within the application properties file. Once you have successfully authenticated, you will be see the Admin Dashboard.

Summary

Congratulations! You have successfully created a Camunda BPM Spring Boot Application. Follow me on any of the different social media platforms and feel free to leave comments.