springboot2.x集成activiti6.0在線流程設計器

我在網上找了不少資料都沒有找到關於activiti6.0的在線流程設計器,大多數都是基於5.x的。由於6.0的源碼包中沒有在線設計器的資源包,所以本文使用的是activiti 5.22.0中web資源包來作的,只是依賴不同ui同樣,下面就能開始來實現一下吧。css

第一步:在activiti官網下載5.22.0的源碼包:https://www.activiti.org/get-startedhtml

第二步: 新建springboot項目在pom中配置以下mysql

< !-- activiti相關依賴-->
 < dependency>
 
 < groupId>org.activiti< /groupId>
 
 < artifactId>activiti-spring-boot-starter-basic< /artifactId>

 < version>6.0.0< /version>
 < /dependency>
 < dependency>
 < groupId>org.activiti< /groupId>
 < artifactId>activiti-json-converter< /artifactId>
 < version>6.0.0< /version>
 < exclusions>
 < exclusion>
 < groupId>org.activiti< /groupId>
 < artifactId>activiti-bpmn-model< /artifactId>
 < /exclusion>
 </ exclusions>
 < /dependency>
 < !-- activiti相關依賴-->



< !-- xml解析依賴-->
 < dependency>
 < groupId>org.apache.xmlgraphics< /groupId>
 < artifactId>batik-codec< /artifactId>
 < version>1.7< /version>
 < /dependency>
 < dependency>
 
 < groupId>org.apache.xmlgraphics< /groupId>
 < artifactId>batik-css</ artifactId>
 < version> 1.7< /version>
 < /dependency>
 < dependency>
 < groupId>org.apache.xmlgraphics< /groupId>
 < artifactId>batik-svg-dom< /artifactId>
 < version>1.7< /version>
 < /dependency>
 < dependency>
 < groupId>org.apache.xmlgraphics< /groupId>
 < artifactId>batik-svggen< /artifactId>
 < version>1.7< /version>
 < /dependency>
 < !-- xml解析依賴-->

數據源配置yml:(若是使用jdbc8的版本必須配置nullCatalogMeansCurrent=true,否則啓動建表會報錯,具體能夠網上自行找答案,這裏就很少說了)web

spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driverspring

url: jdbc:mysql://127.0.0.1:3306/oa?useSSL=false&nullCatalogMeansCurrent=true
username: root
password: 你的密碼
activiti:sql

不自動檢查resources/bpmn目錄

check-process-definitions: falseapache

第三步: 靜態資源整合json

下載完之後,解壓activiti-5.22.0的包,解壓activiti-webapp-explorer2,把webapp下面的diagram-viewer、editor-app、modeler.html複製到springboot項目下的static下,這是activiti的在線設計器,modeler.html就是設計的主界面,複製resources下stencilset.json到本身的resources下。將libs下的activiti-modeler-5.22.0-sources.jar解壓出來,把org\activiti\rest\editor路徑下的main、model文件夾複製到springboot項目的源碼路徑下,裏面有三個類,主要用於讀取stencilset.json。springboot

在這裏插入圖片描述

修改editor-app下的app-cfg.js,把contextRoot後面改爲 ‘’(這個和控制器的和controller裏面加的requestMapping要一致app

第四步:處理bug,就是在啓動的app入口中排除org.activiti.spring.boot.SecurityAutoConfiguration這個類

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class ActivitiWebDemoApplication {
public static void main(String[] args) {
SpringApplication.run(ActivitiWebDemoApplication.class, args);
}
}
第五步: 測試

運行項目訪問 http://localhost:8002/editor 就會出現如下效果!
在這裏插入圖片描述

第六步: 總結 居然都看到最後了,給小編點個關注吧,小編還會持續更新的,只收藏不點關注的都是在耍流氓!