使用springboot activiti关闭验证自动部署方式

时间:2022-01-05 18:41:18

springboot activiti关闭验证自动部署

?
1
2
3
4
5
6
7
8
9
10
11
# spring-activiti
# 自动部署验证设置:true-开启(默认)、false-关闭
spring.activiti.check-process-definitions=false
# asyncExecutorEnabled属性设置设置true后将代替那些老的Job executor
spring.activiti.async-executor-enabled=false
spring.activiti.job-executor-activate=false
# asyncExecutorActivate是指activiti在流程引擎启动就激活AsyncExecutor,异步:true-开启(默认)、false-关闭
spring.activiti.async-executor-activate=true
# 使用自定义的mybatis-mapper
spring.activiti.custom-mybatis-mappers=
spring.activiti.custom-mybatis-xmlmappers=

SpringBoot2.0 activiti6.0自动部署流程图

给大家分享我所总结的自动部署流程的两种方法:

1、修改yaml文件关于activiti的配置

使用springboot activiti关闭验证自动部署方式

2、在SpringBoot项目启动的时候自动执行部署方法

1)要将yaml文件中的check-process-definitions(自动检查,部署流程定义文件)修改为false

2)新建实现类实现ApplicationRunner中run方法,并在类上方添加@Component注解

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.komlin.controller;
import org.activiti.engine.RepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**
 * Description:部署流程图
 * date: 2020/7/8 17:07
 *
 * @author mt
 * @since JDK 1.8
 */
@Component
public class ApplicationRunnerImpl implements ApplicationRunner {
    @Autowired
    RepositoryService repositoryService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        Resource[] resources = null;
        try {
            resources = new PathMatchingResourcePatternResolver().getResources("classpath:processes/*.bpmn");
        } catch (IOException e) {
            e.printStackTrace();
        }
        for (Resource r : resources) {
            String addr = "processes/" + r.getFilename();
            repositoryService.createDeployment().addClasspathResource(addr).deploy();
        }
    }
}

注:新建的流程图中的id一定要与流程图名称保持一致,不然扫描流程图会报错。。

以上为个人经验,希望能给大家一个参考,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/dengyl2008/article/details/79031974