这篇文章主要为大家展示了“springboot+camunda如何实现工作流”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“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.h3database</groupId>
<artifactId>h3</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如何实现工作流”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注天达云行业资讯频道!