SpringBoot2整合activiti6環(huán)境搭建過程解析
這篇文章主要介紹了SpringBoot2整合activiti6環(huán)境搭建過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
依賴
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- mysql驅(qū)動 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
這里使用的springboot2.0.6的版本,activiti為6.0.0的版本
添加processes目錄

SpringBoot集成activiti默認(rèn)會從classpath下的processes目錄下讀取流程定義文件,所以需要在src/main/resources目錄下添加processes目錄,并在目錄中創(chuàng)建流程文件
application.yml
spring: activiti: check-process-definitions: true #自動檢查、部署流程定義文件 database-schema-update: true #自動更新數(shù)據(jù)庫結(jié)構(gòu) #流程定義文件存放目錄 process-definition-location-prefix: classpath:/processes/ #process-definition-location-suffixes: #流程文件格式 datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/taosir_process?useUnicode=true&useSSL=false&characterEncoding=utf8 username : root password : root initsize : 10 maxActive : 20 minIdle : 10 maxWait : 120000 poolPreparedStatements : false maxOpenPreparedStatements : -1 validationQuery : select 1 testOnborrow : true testOnReturn : true testWhileIdle : true timeBetweenEvictionRunsMillis : 120000 server: port: 8764
bpmn文件
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="Examples" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1539757531057" name="" targetNamespace="Examples" typeLanguage="http://www.w3.org/2001/XMLSchema">
<process id="oneTaskProcess" isClosed="false" name="The One Task Process" processType="None">
<startEvent id="theStart"/>
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask"/>
<userTask activiti:assignee="${user}" activiti:exclusive="true" id="theTask" name="my task"/>
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd"/>
<endEvent id="theEnd"/>
</process>
</definitions>
啟動類,注意@SpringBootApplication注解需要設(shè)置exclude屬性
package cn.zytao.taosir.process;
import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class ProcessApplication {
public static void main(String[] args) {
SpringApplication.run(ProcessApplication.class, args);
}
}
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
關(guān)于java.math.BigDecimal比較大小問題
這篇文章主要介紹了關(guān)于java.math.BigDecimal比較大小問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-07-07
Java實現(xiàn)訂單超時未支付自動取消的8種方法總結(jié)
這篇文章主要為大家介紹了Java實現(xiàn)訂單超時未支付自動取消功能的8種不同方法,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下2022-08-08
Java虛擬機(jī)運行時數(shù)據(jù)區(qū)域匯總
這篇文章主要給大家介紹了關(guān)于Java虛擬機(jī)運行時數(shù)據(jù)區(qū)域的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用Java具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08
java實現(xiàn)省市區(qū)轉(zhuǎn)換成樹形結(jié)構(gòu)
這篇文章主要為大家詳細(xì)介紹了java實現(xiàn)省市區(qū)轉(zhuǎn)換成樹形結(jié)構(gòu),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-08-08

