Getting Started with Camunda & Spring Boot 🍃
Tags: camunda, java, spring, automation
Published: 2021-11-27 08:39:38

This tutorial intends to gives you a quick and practical introduction to the open-source workflow and decision automation platform Camunda! 🦊

[Here](https://github.com/tgotwig/camunda-demo) you can find the code for this chapter under the git tag `chapter-1`.

## 💿 Requirements

- Java 8+
- Maven
- [Camunda Modeler](https://camunda.com/download/modeler) (you can install it on Linux by executing `support/xdg_register.sh` after extracting the archive)

## 🏃 Let's go!

The easiest way to get started is to download [this sample project](https://docs.camunda.org/get-started/spring-boot/model):

```bash
curl -L https://github.com/camunda/camunda-get-started-spring-boot/archive/Step-3.zip \
  | bsdtar -xvf - -C .
```

Which you can then execute with Maven:

```bash
cd camunda-get-started-spring-boot-Step-3 && mvn spring-boot:run
```

Now surf towards [localhost:8080](http://localhost:8080) and login via demo & demo:

![image](https://user-images.githubusercontent.com/30773779/143623020-0c878f77-e622-4d1d-b981-46414c702928.png)

## 🌐 Taking a closer look into the browser app

Now click on `Tasklist`:

![image](https://user-images.githubusercontent.com/30773779/143627050-b2ba203e-ea35-45bf-8a39-2de64cbf2a3d.png)

From the second column you can see that you have a process running, which is on hold because of the `User Task` named `Check the request`, which requires that a user takes a look at it and allows further execution:

![image](https://user-images.githubusercontent.com/30773779/143622893-2b33c717-aed7-4af3-9773-1f8ac5615de6.png)

You can do so by clicking on `Complete` from within the first tab:

![image](https://user-images.githubusercontent.com/30773779/143627087-3bbc92ba-728d-41e7-8bd0-75dff35aaf6b.png)

## ⚙️ Adding a Service Task to loanApproval.bpmn

One way to let Camunda execute a own Java function by creating a `Service Task` from within the Camunda Modeler, you should see the following view by opening `loanApproval.bpmn` with the modeler:

![image](https://user-images.githubusercontent.com/30773779/143627113-c7f13348-7ef6-4d37-95de-edcd59ff2018.png)

Within **block #1** you can set `ID` and `Name`, **block #2** is for pointing to your own Java function. It's most practical name `ID` like your Java function:

```java
package org.camunda.bpm.getstarted.loanapproval.delegates;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

@Component
public class MainDelegate {

    public void validateTheRequest(DelegateExecution execution) {
        System.out.println("🚀 Executing MainDelegate.validateTheRequest");
    }
}

```

Now you should see a new item from within your browser:

![image](https://user-images.githubusercontent.com/30773779/143623140-11451fb8-4553-4615-87bd-9ca149de7ea0.png)

Switch back to the first tab `Form` and click again on `Complete`, this time it should go through your own Java function, the Spring terminal proves it:

```bash
...
2021-11-26 20:19:49.855  INFO 2249 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Completed initialization in 5 ms
🚀 Executing MainDelegate.validateTheRequest
```

Nice! 🥳🎉 I think I will add some testing for the next article, stay tuned and happy coding! 🤗