springboot camunda 工作流

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

springboot camunda 工作流

亲爸爸   2022-05-23 我要评论

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.结果:已经成功执行任务

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们