08-Flowable SpringBoot2.X集成

Flowable SpringBoot2.X集成

  • 1. 添加pom依赖
  • 2. application.yml文件配置
  • 3. 启动

1. 添加pom依赖

主要依赖如下:

<parent>
	<groupId>org.springframework.bootgroupId>
	<artifactId>spring-boot-starter-parentartifactId>
	<version>2.1.1.RELEASEversion>
	<relativePath/> 
parent>

<properties>
	<java.version>1.8java.version>
	<flowable.version>6.4.0flowable.version>
properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-starter-webartifactId>
	dependency>

	<dependency>
		<groupId>mysqlgroupId>
		<artifactId>mysql-connector-javaartifactId>
		<version>5.1.28version>
	dependency>

	<dependency>
		<groupId>com.alibabagroupId>
		<artifactId>druidartifactId>
		<version>1.1.0version>
	dependency>
	<dependency>
		<groupId>org.projectlombokgroupId>
		<artifactId>lombokartifactId>
		<optional>trueoptional>
	dependency>
	<dependency>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-starter-testartifactId>
		<scope>testscope>
	dependency>


	<dependency>
		<groupId>org.flowablegroupId>
		<artifactId>flowable-spring-boot-starter-basicartifactId>
		<version>${flowable.version}version>
	dependency>

	
	<dependency>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-devtoolsartifactId>
		<optional>trueoptional>
		<scope>truescope>
	dependency>

dependencies>

注意事项
在flowable与springboot2.x集成过程中,flowable相关表自动创建不能成功,发现是mysql驱动引起的。springboot2.x的mysql驱动是 mysql-connector-java 6(com.mysql.cj.jdbc.Driver),jar包依赖为6以上版本。将mysql驱动改为mysql-connector-java 5(com.mysql.jdbc.Driver),jar包依赖改为6以下版本,flowable相关表可以自动创建成功

2. application.yml文件配置

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/activiti_springboot?characterEncoding=UTF-8
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
#flowable:
#  database-schema-update: create-drop
 # check-process-definitions: false

3. 启动

启动引导类,启动成功后,观察mysql数据库,可以查看到自动生成的flowable相关数据表。
08-Flowable SpringBoot2.X集成_第1张图片

你可能感兴趣的:(Flowable)