springboot~工做流activiti的搭建

概念

工做流產品使用activiti的算是比較多了,自帶了一套UI界面,能夠直接使用,用來設計流程,下面簡單總結一下它的步驟:java

1 設計模型mysql

2 發佈爲流程,一個模型能夠發佈多個版本的流程web

3 創建一個流程的實例和實例任務,一個流程能夠創建多個並行的實例spring

4 對某個實例任務進行審批sql

5 能夠查看實時的流程實例狀態app

部署在項目裏

添加引用spring-boot

   annotationProcessor  'org.projectlombok:lombok:1.18.2' //gradle5.0以後須要這樣引用lombok
    compileOnly 'org.projectlombok:lombok:1.18.2'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.2'
    testCompileOnly 'org.projectlombok:lombok:1.18.2'

    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

    implementation 'org.activiti:activiti-diagram-rest:5.22.0'
    implementation 'org.activiti:activiti-modeler:5.22.0'
    implementation 'org.activiti:activiti-spring-boot-starter-basic:5.22.0'

    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'mysql:mysql-connector-java'
    implementation 'org.assertj:assertj-core:3.3.0'
    implementation 'com.google.guava:guava:18.0'
    testImplementation 'com.h2database:h2:1.3.176'
    testImplementation('org.springframework.boot:spring-boot-starter-test')

添加啓動文件gradle

import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,})
public class AvtivitiApplication {
    public static void main(String[] args) {
        SpringApplication.run(AvtivitiApplication.class, args);
    }

}

添加yml配置google

server:
  port: 8081

spring:
  application:
    name: activiti-demo
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf-8&useSSL=false
    username: root
    password: root
  jpa:
    hibernate:
      ddl-auto: none
    show-sql: true

  activiti:
    check-process-definitions: false
    font:
      activityFontName: 宋體
      labelFontName: 宋體

訪問模型添加頁面url

 

保存以後,將在模型表ACT_RE_MODEL添加數據,ACT_GE_BYTEARRAY資源表也會生成對象的數據,如模型的圖片和模型對應的XML文件等。

相關文章
相關標籤/搜索