项目环境
springboot版本=2.3.5.RELEASE, flowable版本=6.7.2
集成步骤
maven依赖
<flowable.version>6.7.2</flowable.version>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-bpmn-layout</artifactId>
<version>${flowable.version}</version>
</dependency>
application.yml配置
spring:
#数据库链接配置
datasource:
# 自动建立表结构,&nullCatalogMeansCurrent=true. 注意加这个配置!!!!
url: jdbc:mysql://127.0.0.1:3306/flowable?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF8&nullCatalogMeansCurrent=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
flowable:
#异步执行
async-executor-activate: false
#自动更新数据库
database-schema-update: true
#校验流程文件,默认校验resources下的processes文件夹里的流程文件
process-definition-location-prefix: classpath*:/processes/
process-definition-location-suffixes: "**.bpmn20.xml, **.bpmn"
说明: 第一次启动会自动创建创建数据库。
出现mysql报错
如果出现如下报错。 MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes。
报错原因
myql用的是utf8mb4字符集,descirption_ 字段类型为varchar255,长度为256*4>767报错了
解决办法
SET GLOBAL innodb_large_prefix = ON; SET GLOBAL innodb_file_format=Barracuda; 索引列总长度的不能大于3072 bytes的限制。当把3个varchar255的字段合起来建索引会报错,加下面这句就好了 SET GLOBAL innodb_file_per_table = ON;