springboot+camunda實現工作流的流程分析

1.在camunda modeler工具裡面寫流程,任務執行指明Java類

2.保存文件放在resources目錄下,並建立一個processes.xml的空文件

3.依賴配置

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- camunda依賴 -->
        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

4.yml配置:建立一個空數據庫既可以,運行後會自動建表

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/camunda
    username: root
    password: root
camunda:
  bpm:
    admin-user:
      id: admin
      password: admin
      first-name: admin
    filter:
      create: All tasks
    #指定數據庫類型
      database:
          type: mysql
    #自動部署resources下面的bpmn文件
    auto-deployment-enabled: true
    #禁止index跳轉到Camunda自帶的管理界面,默認true
#    webapp:
#      index-redirect-enabled: false

5.編寫任務中的Java執行類

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/camunda
    username: root
    password: root
camunda:
  bpm:
    admin-user:
      id: admin
      password: admin
      first-name: admin
    filter:
      create: All tasks
    #指定數據庫類型
      database:
          type: mysql
    #自動部署resources下面的bpmn文件
    auto-deployment-enabled: true
    #禁止index跳轉到Camunda自帶的管理界面,默認true
#    webapp:
#      index-redirect-enabled: false

6.登錄執行,點擊tasklist,

7.結果:已經成功執行任務

到此這篇關於springboot+camunda實現工作流的文章就介紹到這瞭,更多相關springboot camunda 工作流內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!

推薦閱讀: