使用的集成开发工具是 Intellij idea
1.maven配置
xml version="1.0" encoding="UTF-8"?>xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.wang.oa oa 0.0.1-SNAPSHOT jar oa Demo project for Spring Boot org.springframework.boot spring-boot-starter-parent 1.4.2.RELEASE UTF-8 UTF-8 1.8 org.activiti activiti-spring-boot-starter-basic 6.0.0.RC1 org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-web mysql mysql-connector-java org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin
2.在resources目录下创建 文件夹processes
3.安装activiti插件,如下图
4.在processes目录下创建 一个test.bpmn文件的bpmn文件
5.数据库配置
spring: datasource: driver-class-name: com.mysql.jdbc.Driver username: root password: root url: jdbc:mysql://localhost:3306/act jpa: show-sql: true hibernate: ddl-auto: update
6.运行test.bpmn流程
@RestController public class DemoController { @Autowired RuntimeService runtimeService; @Autowired TaskService taskService; @GetMapping("/hello") String hello(){ String pid = runtimeService.startProcessInstanceByKey("myProcess_1").getId(); Task task = taskService.createTaskQuery().processInstanceId(pid).singleResult(); return "hello world spring boot...."+task.getId(); } };
7.相关的工作流数据库表则创建完成
到此为止集成完成!