Flowable是一个轻量级的工作流和业务流程管理(BPM)平台,它提供了创建、执行和管理业务流程的全面功能。能作为引擎sdk嵌入Java系统,提供了DMN和CMMN更加易于业务系统的开发。本文主要讲解JeecgBoot如何集成Flowable6.7.2工作流引擎,快速体验JeecgFlow
环境介绍
项目 | 版本 |
---|---|
jdk | 1.8 |
jeecgboot | 3.7 |
flowable | 6.7.2 |
集成步骤
在jeecgboot根pom.xml , 新增maven依赖支持flowable工作流引擎,因为flowable包含了mybatis,但JeecgBoot已经引入了mybatis,所以这里把mybatis排除,或者会报错。
<flowable.spring-boot.version>6.7.2</flowable.spring-boot.version>
<!--一定要在这个标签下:dependencyManagement进行添加-->
<dependencyManagement>
<dependencies>
<!--以下是所需的依赖文件-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
第一个目标就是在JeecgBoot项目下,新建一个模块jeecg-module-flowable,专门管理流程引擎相关代码。 请按照如下步骤,逐步完成所有的配置。
<dependencies>
<!--Flowable模块-->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-flowable</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
</dependencies>
在application-dev.yml, application-test.yml, application-prod.yml添加flowable配置.
flowable:
#关闭定时任务JOB
async-executor-activate: false
#将databaseSchemaUpdate设置为true。当flowable发现库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。
database-schema-update: true
# 自动部署验证设置:true-开启(默认)、false-关闭
check-process-definitions: false
#保存历史数据级别设置为full最高级别,便于历史数据的追溯
history-level: full
配置SwaggerConfig
@Bean(value = "flowableApi2")
public Docket flowableApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()).groupName("Flowable模块")
.select()
//此包路径下的类,才生成接口文档
.apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.flowable"))
//加了ApiOperation注解的类,才生成接口文档
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.build()
.securitySchemes(Collections.singletonList(securityScheme()));
//.globalOperationParameters(setHeaderToken());
}
以上就是JeecgBoot集成Flowable工作流核心步骤,具体详情访问Jeecgflow