3七、Springboot集成Flowable

工做流是OA系统不可或缺的一部分,今天介绍一款新的工做流引擎flowable。flowable 是著名 Java 工做流引擎 Activiti 的原做者从 Activiti 分支建立的新工做流引擎。flowable 是一个业务流程管理(BPM)和工做流系统,适用于开发人员和系统管理员。其核心是超快速,稳定的BPMN2流程引;易于与 Spring集成使用。java

一、Flowable 设计器Flowable Designer安装
下载地址:mysql

https://blog.flowable.org/2016/11/01/flowable-eclipse-designer-5-22-0-release/

image.png
在线安装地址:web

http://flowable.org/designer/update

离线安装包地址:spring

http://www.flowable.org/designer/archived/flowable-designer-5.22.0.zip

image.png
二、 新建项目sc-flowable,对应的pom.xml文件以下sql

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.flowable</groupId>
    <artifactId>sc-flowable</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>sc-flowable</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <!-- HikariCP 链接池依赖 -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter-basic</artifactId>
            <version>6.4.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
    </dependencies>
</project>

三、新建配置文件application.yml数据库

spring:
  datasource:
    driver-class-name : com.mysql.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8
    username: root
    password: root
logging:
  level:
    ROOT: info
flowable:
  #关闭定时任务JOB
  async-executor-activate: false
  #将databaseSchemaUpdate设置为true。当Flowable发现库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。
  database-schema-update: true

配置文件中主要配置数据库的地址、用户名及密码apache

四、新建springboot启动类springboot

package com.flowable;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class FlowableApplication {

    public static void main(String[] args) {
        SpringApplication.run(FlowableApplication.class, args);
    }

}

五、验证是否集成flowable成功
运行后FlowableApplication.java,期间没有任何异常信息;查看数据库,已经自动生成了flowable相关的表结构
image.pngapp