springboot 集成activity示例
时间: 2023-09-16 14:06:35 浏览: 223
springboot集成activiti demo
好的,关于Spring Boot集成Activity的示例,可以参考下面的代码:
1.添加Maven依赖
```
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>${camunda.version}</version>
</dependency>
```
2.配置Camunda引擎
```
spring:
datasource:
url: jdbc:h2:file:./camunda-h2-database
driver-class-name: org.h2.Driver
username: sa
password:
camunda:
bpm:
database:
schema-update: true
authorization:
enabled: false
generic-properties:
properties:
history: full
bpmn:
deploy-changed-only: true
webapp:
index-redirect-enabled: true
```
3.添加Activity的starter依赖
```
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
```
4.配置Activity引擎
```
spring:
activiti:
db-history-used: true
database-schema-update: true
database-table-prefix: ACT_
process-definition-location-prefix: classpath:/processes/
```
5.创建简单的流程定义
```
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
targetNamespace="http://activiti.org/bpmn20">
<process id="simple-process" name="Simple Process"
isExecutable="true">
<startEvent id="start" name="Start"></startEvent>
<endEvent id="end" name="End"></endEvent>
<sequenceFlow id="flow1" sourceRef="start" targetRef="end"></sequenceFlow>
</process>
</definitions>
```
6.启动应用程序,访问Camunda应用或Actitivy应用,查看部署的流程并启动它。
希望能帮助你!
阅读全文