前提准备
1.依赖:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>7.1.0.M4</version>
</dependency>
<dependency>
<groupId>org.activiti.dependencies</groupId>
<artifactId>activiti-dependencies</artifactId>
<version>7.1.0.M4</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.13</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
2.配置文件
注意数据库版本对应,与连接的url后面的参数,同时官方因为有些小bug,需要我们自己写sql修复一下,下载直接在数据库运行即可。
port: 8090
spring:
application:
name: workflow
datasource:
name: mysqlDatasource
url: jdbc:mysql://localhost:3306/avtivity?useUnicode=true&nullCatalogMeansCurrent=true
username: root
password: 5771323
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
# 监控统计拦截的filters,如果启用log4j记得添加依赖
filters: stat,wall
# activiti
activiti:
#每次应用启动不检查Activiti数据表是否存在及版本号是否匹配,提升应用启动速度
database-schema-update: true
#activiti7默认不生成历史信息表,开启历史表
db-history-used: true
#在项目单独作为一个引擎,本身不部署流程的时候,如果resources目录没有“processes”目录,启动项目报错–找不到processes目录。需要在配置文件中添加以下内容:
check-process-definitions: false
process-definition-location-prefix: classpath:/processes/
process-definition-location-suffixes:
-**.bpmn
-**.bpmn20.xml
#保存历史数据级别设置为full最高级别,便于历史数据的追溯
history-level: full
# activiti 安全访问
security:
basic:
enabled: true
user:
name: root
password: root