什么是flowable?
对于flowable是什么以及关于此框架的具体信息可以参看此项目的官方文档:
https://www.flowable.org/docs/userguide/index.html
官网对于此项目如何使用有非常详细的描述,只是目前还没有对应的中文文档。
Flowable is a light-weight business process engine written in Java.
这是官网文档对此框架的完美解释:Flowable是一个用java语言写的轻量级工作流引擎。
在简单了解flowable后与activiti框架相比的第一感觉就是开发方便快速,易与springBoot等各种框架快速整合。如果项目中需要快速实现一些工作流的相关功能那么用此框架是一个不错的选择。
使用版本
用测试方便,这里都使用springBoot和flowable最新的稳定版本
springBoot版本:2.0.1.RELEASE
flowable版本:6.3.0
Flowable与springBoot项目整合
添加依赖
将flowable的依赖加入到POM中即可,flowable使用需要一个数据库,这里为了方便我选择mysql
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--flowable工作流依赖-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.6.0</version>
</dependency>
<!--mysql依赖-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>runtime</version>
</dependency>
</dependencies>
flowable配置
测试方便flowable配置为默认的即可。为了测试时方便看日志信息,我这里将flowable的定时job功能暂时关闭,其他的都用默认的
当然记得要添加一个数据源,我这里添加的mysql,并且记得建好对应的mysql库,如果没有建就自己建一个吧
like this:
CREATE DATABASE flowable DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
server:
port: 9999
spring:
datasource:
url: jdbc:mysql://localhost:3306/flowable?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
#开启调试信息
logging:
level:
org:
flowable: DEBUG
#业务流程涉及的表自动生成
flowable:
database-schema-update: true
async-executor-activate: false
#关闭定时任务JOB
#async-executor-activate: false
这样操作后,flowable与springBoot的整个就完成了!
然后就可以运行了,如果指定的数据库中还未创建过flowable的相关数据表,则初次运行时flowable会将自动执行flowable中的初始化脚本完成工作流所需要的数据表的建立。
Tables_in_flowable
act_app_appdef
act_app_databasechangelog
act_app_databasechangeloglock
act_app_deployment
act_app_deployment_resource
act_cmmn_casedef
act_cmmn_databasechangelog
act_cmmn_databasechangeloglock
act_cmmn_deployment
act_cmmn_deployment_resource
act_cmmn_hi_case_inst
act_cmmn_hi_mil_inst
act_cmmn_hi_plan_item_inst
act_cmmn_ru_case_inst
act_cmmn_ru_mil_inst
act_cmmn_ru_plan_item_inst
act_cmmn_ru_sentry_part_inst
act_co_content_item
act_co_databasechangelog
act_co_databasechangeloglock
act_dmn_databasechangelog
act_dmn_databasechangeloglock
act_dmn_decision
act_dmn_deployment
act_dmn_deployment_resource
act_dmn_hi_decision_execution
act_evt_log
act_fo_databasechangelog
act_fo_databasechangeloglock
act_fo_form_definition
act_fo_form_deployment
act_fo_form_instance
act_fo_form_resource
act_ge_bytearray
act_ge_property
act_hi_actinst
act_hi_attachment
act_hi_comment
act_hi_detail
act_hi_entitylink
act_hi_identitylink
act_hi_procinst
act_hi_taskinst
act_hi_tsk_log
act_hi_varinst
act_id_bytearray
act_id_group
act_id_info
act_id_membership
act_id_priv
act_id_priv_mapping
act_id_property
act_id_token
act_id_user
act_procdef_info
act_re_deployment
act_re_model
act_re_procdef
act_ru_actinst
act_ru_deadletter_job
act_ru_entitylink
act_ru_event_subscr
act_ru_execution
act_ru_external_job
act_ru_history_job
act_ru_identitylink
act_ru_job
act_ru_suspended_job
act_ru_task
act_ru_timer_job
act_ru_variable
flw_channel_definition
flw_ev_databasechangelog
flw_ev_databasechangeloglock
flw_event_definition
flw_event_deployment