SpringBoot集成系列--Flowable
    		       		warning:
    		            这篇文章距离上次修改已过421天,其中的内容可能已经有所变动。
    		        
        		                
                Flowable 是一个用 Java 编写的轻量级业务流程引擎,它实现了 BPMN 2.0 标准。Flowable 可以在 Apache 许可下免费用于商业和开源目的。
Spring Boot 与 Flowable 的集成可以通过以下步骤实现:
- 在 Spring Boot 项目的 
pom.xml文件中添加 Flowable 依赖。 
<dependencies>
    <!-- Flowable 核心库 -->
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-engine</artifactId>
        <version>6.7.2</version>
    </dependency>
    <!-- Flowable 任务服务(可选,如果需要与流程相关的界面交互) -->
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-task</artifactId>
        <version>6.7.2</version>
    </dependency>
    <!-- Flowable rest API(可选,如果需要通过 REST 方式与流程交互) -->
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-rest</artifactId>
        <version>6.7.2</version>
    </dependency>
    <!-- Flowable 事件订阅(可选,如果需要通过事件订阅方式与流程交互) -->
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-eventregistry-spring</artifactId>
        <version>6.7.2</version>
    </dependency>
</dependencies>- 在 
application.properties或application.yml配置文件中配置 Flowable。 
# 数据库配置
spring.datasource.url=jdbc:mysql://localhost:3306/flowable?useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 
# 流程引擎配置
flowable.database-schema-update=true
flowable.async-executor-activate=false- 在 Spring Boot 启动类中配置 Flowable 的 ProcessEngine。
 
import org.flowable.engine.ProcessEngine;
import org.flowable.spring.boot.EngineConfigurationKey;
import org.flowable.spring.boot.FlowableServletDeploymentListener;
import org.flowable.spring.boot.SpringBootProcessEngineConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
 
@SpringBootApplication
public class FlowableApplication {
 
    public static void main(String[] args) {
        SpringApplication.run(FlowableApplication.class, args);
    }
 
    @Bean
    public SpringBootProcessEngineConfiguration processEngineConfig           
评论已关闭