首页 > 编程开发 > Java    日期:2022-01-09 / 浏览

1.在camunda modeler工具里面写流程,任务执行指明Java类

springboot+camunda实现工作流的流程分析

2.保存文件放在resources目录下,并建立一个processes.xml的空文件

springboot+camunda实现工作流的流程分析

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,

springboot+camunda实现工作流的流程分析

springboot+camunda实现工作流的流程分析

springboot+camunda实现工作流的流程分析

7.结果:已经成功执行任务

springboot+camunda实现工作流的流程分析

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章