Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Embed Camunda into your Spring Boot application

You can use Camunda as a library within your own Spring Boot application by leveraging the Camunda Spring Boot Starter.

This is one of multiple possible approaches.


This video walks you through the whole procedure:



  1. Add a normal Spring REST controller to provide your custom REST API to say hello.

  2. Add a Maven dependency (see pom.xml) for Camunda. There is one for the core engine, one for the REST API and one for web tools like Cockpit (make sure you also have a data source available, I use H2 for the simple example).

<dependency> <!-- Headless engine -->
<dependency> <!-- REST API, contains headless engine -->
<dependency> <!-- Web tools, contains headless engine -->
  1. Use @EnableProcessApplication and add a META-INF/processes.xml file. While this is optional, it is the recommended way of doing it with some advantages.

  2. Add the BPMN workflow to src/main/resources.

  3. Implement a Spring bean to express the logic of the "Sysout" service task.

Please refer to the sample application available on GitHub for all the details.

The Spring Boot application includes a proper JUnit test cases (using an in-memory H2 database) and can be started locally (using a file based H2 database).

Now you can push this application to PCF:

  • Add a service for a relational database named camunda-db. I used ElephantDB as managed service offering of PostgreSQL. But any database supported for Camunda will do.
  • Install PCF CLI locally.
  • Login (use as API endpoint if you run on PCF in the cloud):
cf login
  • Build and push the application. Check the PCF manifest file to make sure that it references the right database service.
mvn clean install && cf push -p target/*.jar

Hint: In on-prem installations of PCF the java buildpack might not yet be available, then you need to specify that in your command:

cf push -p target/*.jar

No you can trigger your own REST API with a client of your choice (e.g. Postman, ARC or CURL):

curl --request POST -F 'text=some text shown later'

You can also use the Camunda REST API to access the engine, e.g. to query completed process instances:


Possible extensions

Using an external database

You might not leverage a PCF service to provide the database. In this case you have to

  • Configure your database properties in the cloud profile, e.g. by copying spring.datasource.url and related datasource parameters in a file, e.g.
spring.datasource.url= # JDBC URL of the database.
spring.datasource.username= # Login username of the database.
spring.datasource.password= # Login password of the database.
  • Make sure you disable the 'DataSourceCloudConfiguration', the easiest way is to delete the file completly.

Further reading

A more sophisticated example using AMQP can be found here:

You can’t perform that action at this time.