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.

Camunda Process Engine and Spring Boot

This example demonstrates how to bootstrap the Camunda process engine with Spring Boot. You learn

  • How to create a POM with the required dependencies,
  • How to configure the process engine via Java Config,
  • How to create the application class and start a process instance on startup

The example process looks like:

Example Process

Run it as JUnit Test

The JUnit test CamundaSpringBootExampleApplicationTest starts the application and verifies that a process instance is started.

How it works

Follow steps to create a basic setup for your Spring Boot application which embeds the Camunda Process Engine.

Note that you can generate your project skeleton using the Spring Initializr.

Add required dependencies to POM

Create a basic pom.xml for your project and add the following dependencies for the process engine and Spring Boot.


  <!-- spring boot -->
  <!-- camunda -->
  <!-- database (e.g. h2) -->
  <!-- test (e.g. spring-test, junit, mockito etc.) -->


Also add the following Spring Boot plugin to build the JAR.


Configure the Process Engine

Create the following Java Config class to bootstrap and configure the process engine.

@Import( SpringProcessEngineServicesConfiguration.class )
public class CamundaProcessEngineConfiguration {

  private String historyLevel;

  // add more configuration here
  // ---------------------------

  // configure data source via
  private DataSource dataSource;

  private ResourcePatternResolver resourceLoader;

  public SpringProcessEngineConfiguration processEngineConfiguration() throws IOException {
    SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();





    // deploy all processes from folder 'processes'
    Resource[] resources = resourceLoader.getResources("classpath:/processes/*.bpmn");

    return config;

  public PlatformTransactionManager transactionManager() {
    return new DataSourceTransactionManager(dataSource);

  public ProcessEngineFactoryBean processEngine() throws IOException {
    ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
    return factoryBean;


In this configuration the data source and the history level of the process engine are configured by the Add the following lines to use an In-Memory H2 database and audit history level.

# data source config
# logging config
# camunda config

Note that you can add even more configuration (e.g. for logging).

Create an Application Class

Create an application class which is annotated with SpringBootApplication and implement the main method as follow:

public class CamundaSpringBootExampleApplication {

  private RuntimeService runtimeService;

  public static void main(String[] args) {, args);

  public void startProcess() {


On startup, the application loads the configuration and initialize all beans. After initialization, it creates an instance of the process with id 'loanRequest'.

How to use it?

  1. Checkout the project with Git
  2. Import the project into your IDE
  3. Build it with Maven clean install
  4. Execute the JAR java -jar target/camunda-spring-boot-example-1.0.0-SNAPSHOT.jar
  5. Check the console if you can find the line calculating interest
You can’t perform that action at this time.