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

相關文章
相關標籤/搜索