Backend Development 15 min read

Building a Leave Approval Workflow with Flowable UI and Spring Boot

This article provides a step‑by‑step guide on deploying Flowable‑UI, designing BPMN diagrams, configuring a Spring Boot backend, managing Flowable database tables, and using Flowable engine APIs to implement a complete leave‑approval workflow with code examples.

Top Architect
Top Architect
Top Architect
Building a Leave Approval Workflow with Flowable UI and Spring Boot

Overview

The tutorial demonstrates how to use Flowable’s built‑in UI (flowable‑ui) to create a BPMN diagram and then develop a Spring Boot backend that executes the workflow.

1. Deploying flowable‑ui

Download https://github.com/flowable/flowable-engine/releases/download/flowable-6.6.0/flowable-6.6.0.zip , extract flowable-6.6.0\wars\flowable-ui.war , and deploy it to Tomcat. Access the UI at http://localhost:8080/flowable-ui with credentials admin/test . Use the APP.MODELER to design the process and export the BPMN file.

2. Designing the BPMN diagram

The diagram includes basic Flowable elements: event , sequence flow , gateway , and user task . The example models a leave request that passes through student, teacher, and principal approval steps, with conditional gateways based on the variable command (agree/refuse).

3. Backend project setup

The backend is a Spring Boot 2.3.0 application running on JDK 8. Maven dependencies include org.flowable:flowable-spring-boot-starter:6.6.0 and mysql:mysql-connector-java:5.1.45 . The application.yml configures a MySQL datasource.

4. Flowable database tables

Flowable creates tables prefixed with ACT_ :

ACT_RE_ : repository tables (process definitions, models).

ACT_RU_ : runtime tables (tasks, executions, variables).

ACT_HI_ : history tables (completed instances, tasks).

ACT_GE_ : generic tables (byte arrays, properties).

Additional tables manage users, groups, and identity links.

5. Engine API usage

The main services are:

RepositoryService – deploy and query process definitions.

RuntimeService – start process instances.

TaskService – query, claim, and complete user tasks.

IdentityService – manage users and groups.

HistoryService – query completed instances and tasks.

Sample Java code shows how to deploy a ZIP of BPMN files, start a process, claim and complete tasks for the student and teacher groups, pass variables to gateways, and query historic data.

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.*;
import org.flowable.engine.history.*;
import org.flowable.engine.repository.*;
import org.flowable.engine.runtime.*;
import org.flowable.idm.api.*;
import org.flowable.task.api.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.*;
import java.util.*;

@Slf4j
public class TestFlowable {
    @Autowired private RepositoryService repositoryService;
    @Autowired private RuntimeService runtimeService;
    @Autowired private HistoryService historyService;
    @Autowired private org.flowable.engine.TaskService taskService;
    @Autowired private org.flowable.engine.IdentityService identityService;
    public void createDeploymentZip() {
        try {
            File zipTemp = new File("f:/leave_approval.bpmn20.zip");
            ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipTemp));
            Deployment deployment = repositoryService.createDeployment()
                .addZipInputStream(zipInputStream)
                .deploy();
            log.info("部署成功:{}", deployment.getId());
        } catch (FileNotFoundException e) { e.printStackTrace(); }
        // ... (rest of the steps: query definitions, start process, claim/complete tasks, query history)
    }
}

6. References

Links to Flowable documentation, Chinese translations, and related blog posts are provided for further reading.

BackendJavaworkflowBPMNSpring Bootprocess-engineFlowable
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.