2. flowable - SpringBoot集成flowable
pom.xml加入flowable的依赖,这边选择的是6.6版本
1 <properties> 2 <java.version>1.8</java.version> 3 <flowable.version>6.6.0</flowable.version> 4 </properties> 5 <dependencies> 6 <dependency> 7 <groupId>org.springframework.boot</groupId> 8 <artifactId>spring-boot-starter-freemarker</artifactId> 9 </dependency> 10 <dependency> 11 <groupId>org.springframework.boot</groupId> 12 <artifactId>spring-boot-starter-web</artifactId> 13 </dependency> 14 15 <dependency> 16 <groupId>mysql</groupId> 17 <artifactId>mysql-connector-java</artifactId> 18 <scope>runtime</scope> 19 </dependency> 20 <dependency> 21 <groupId>org.projectlombok</groupId> 22 <artifactId>lombok</artifactId> 23 <optional>true</optional> 24 </dependency> 25 <dependency> 26 <groupId>org.springframework.boot</groupId> 27 <artifactId>spring-boot-starter-test</artifactId> 28 <scope>test</scope> 29 </dependency> 30 31 <dependency> 32 <groupId>org.flowable</groupId> 33 <artifactId>flowable-spring-boot-starter</artifactId> 34 <version>${flowable.version}</version> 35 </dependency> 36 </dependencies>
配置application.properties,这边直接使用项目自动生成的配置文件,没有使用yml配置
1 server.port=8080 2 3 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/workflow?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&serverTimezone=Asia/Shanghai 4 spring.datasource.username=root 5 spring.datasource.password=123456 6 7 flowable.async-executor-activate=false
运行WorkflowApplication,报错提示没有数据库

新建一个workflow的数据库,好了之后再次执行WorkflowApplication

启动后还是报错

百度后找到问题,需要在mysql的连接字符串中添加上nullCatalogMeansCurrent=true,将schema默认设置为当前连接的schema
修改mysql的url
1 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/workflow?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true 2 spring.datasource.username=root 3 spring.datasource.password=123456
再次启动项目,发现项目启动成功,也能自动创建表,看了一下,总共生成了79张表,图没截全

本来以为这个时候可以告一段落了,但是之后重启了一下项目,发现起不起来了,一直报时间格式的错

网上找了很多资料,都没有找到说启动项目的时候就报这个问题,特别还是跟flowable合在一起,于是对比了公司的工作流项目,发现除了版本不一致,其他也没什么问题,于是尝试着修改版本,终于在修改springboot版本后正常了
1 <parent> 2 <groupId>org.springframework.boot</groupId> 3 <artifactId>spring-boot-starter-parent</artifactId> 4 <version>2.2.2.RELEASE</version> 5 <relativePath/> 6 </parent>
这边把自动生成项目的2.4.3改为2.2.2.REALEASE版本,至此,项目再次重启都能正常启动
浙公网安备 33010602011771号