Step-by-Step Guide to Deploying and Using Flowable Workflow Engine with Spring Boot
This article provides a comprehensive tutorial on installing Flowable 6.6.0, deploying its UI, designing BPMN processes, configuring the database, using core Flowable APIs, and integrating the engine into a Spring Boot project with full code examples and deployment instructions.
The author announces the completion of a Spring Cloud Alibaba video series and introduces Flowable, a powerful open‑source BPMN workflow engine, as a practical tool for building approval processes.
1. Deploy 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 the default credentials admin/test . After logging in, use the APP.MODELER to create a process and optionally edit apache-tomcat-9.0.37\webapps\flowable-ui\WEB-INF\classes\flowable-default.properties to point to a local MySQL database.
2. Draw the process diagram
In the modeler, add basic BPMN elements such as events, sequence flows, gateways, and user tasks. The article explains each element and shows a sample leave‑approval flow where a student submits a request, a teacher reviews it, and a principal gives final approval.
3. Backend project setup
The backend is built with JDK 8 and Spring Boot 2.3.0.RELEASE. Add the following dependencies to pom.xml :
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.6.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>Configure the datasource in application.yml to connect to the Flowable database.
4. Database tables
Flowable creates tables prefixed with ACT_ . The article lists the purpose of each prefix (RE – repository, RU – runtime, HI – history, GE – generic) and enumerates key tables such as act_ru_task , act_hi_procinst , act_id_user , etc.
5. Engine API and services
The main services are RepositoryService, RuntimeService, IdentityService, FormService, HistoryService, ManagementService, and DynamicBpmnService. Typical usage includes deploying a BPMN zip, starting a process instance, claiming and completing tasks, and querying historic data.
Code example
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.idm.api.Group;
import org.flowable.idm.api.User;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipInputStream;
@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();
}
// query definitions, start process, claim/complete tasks, query history, etc.
}
}6. References
Flowable documentation (Chinese translation): https://github.com/qiudaoke/flowable-userguide
Official Flowable‑6.6.0 demo
Additional blog post: https://www.cnblogs.com/yangjiming/p/10938515.html
The author concludes with a call for likes, shares, and follows, and provides links to PDF collections of his other Spring Cloud, Spring Boot, and MyBatis tutorials.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.