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 工作流内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!