SpringBoot整合activiti6


创建springboot项目

1.安装activiti相关插件

 IDEA:File/Setting/Plugins  搜索  actiBPM  安装重启 ,此时就能创建bpmnFile

  

  IDEA创建bpmn文件不会自动生成相对应的png图片

 Eclipse: Help/Install New SoftWare/add

  输入内容:    

    Name: Activiti BPMN 2.0 designer

     Location: http://activiti.org/designer/update/

  一直next,傻瓜式安装,安装完毕,重启之后就可创建bpmn文件.

  再 Window/Preferences下进行如下设置,在保存bpmn文件后会自动生成相对应的图片文件

2.创建springboot项目

POM文件添加坐标:

<dependencies>
  <dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-starter-webartifactId>
  dependency>

  <dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-devtoolsartifactId>
    <scope>runtimescope>
    <optional>trueoptional>
  dependency>
  <dependency>
    <groupId>mysqlgroupId>
    <artifactId>mysql-connector-javaartifactId>
    <scope>runtimescope>
  dependency>
  <dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-starter-testartifactId>
    <scope>testscope>
  dependency>
  
  <dependency>
    <groupId>org.activitigroupId>
    <artifactId>activiti-spring-boot-starter-basicartifactId>
    <version>6.0.0version>
  dependency>
dependencies>

application.yml文件配置: 

# 服务配置
server:
  port: 8080
# Spring相关配置
spring:
  ##数据库连接信息
  datasource:
  # 数据源配置
    url: jdbc:mysql://localhost:3306/db_activiti?autoReconnect=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
  activiti:
  # 自动建表
    database-schema: ACTIVITI
    database-schema-update: true
    history-level: full
    db-history-used: true
    # 自动部署验证设置:true-开启(默认)、false-关闭
    check-process-definitions: false

在启动类上添加:

  @SpringBootApplication(exclude = SecurityAutoConfiguration.class)

  import org.activiti.spring.boot.SecurityAutoConfiguration;

  此配置可解决 Springboot 未导入SpringSecurity坐标问题

3.启动 Application启动类,自动生成28张相关表

  • act_ge_ 通用数据表,ge是general的缩写

  • act_hi_ 历史数据表,hi是history的缩写,对应HistoryService接口

  • act_id_ 身份数据表,id是identity的缩写,对应IdentityService接口

  • act_re_ 流程存储表,re是repository的缩写,对应RepositoryService接口,存储流程部署和流程定义等静态数据

  • act_ru_ 运行时数据表,ru是runtime的缩写,对应RuntimeService接口和TaskService接口,存储流程实例和用户任务等动态数据