SpringBoot整合activiti5-流程部署

系列文章目录(springboot整合activiti5)

在Activiti中,定义了多种资源,其中*.bpmn*.bpmn20.xml都是流程定义文件,这两种格式都可以被系统识别并进行解释,但是目前最新版本的Activiti Designer保存的文件都是*.bpmn,而*.png指的是流程定义文件的图片描述,图片内容和流程定义文件描述一致,可以设置在Activiti Designer保存时,同时自动保存一个同名的图片文件。 *.form为表单文件,*.drl为规则定义文件。

Activiti提供了多种部署流程资源的方法,包括自动部署、classpath部署、输入流部署、zip/bar部署和上传部署等方式。

自动部署

在SpringProcessEngineConfiguration当中有一个属性deploymentResources,用于设置需要部署的资源。由于SpringBoot采用自动配置Bean的方式,所以SpringBoot当中会指定默认的路径用于存放自动部署的资源。这个路径是由org.activiti.spring.boot.ActivitiProperties中的两个属性决定的,如下所示

private String processDefinitionLocationPrefix = "classpath:/processes/";
private List<String> processDefinitionLocationSuffixes = Arrays.asList("**.bpmn20.xml", "**.bpmn");

当然也可以通过配置文件配置
在这里插入图片描述
在实例化SpringProcessEngineConfiguration类型Bean的时候查找资源并设置到deploymentResources属性当中
在这里插入图片描述
在这里插入图片描述
根据流程引擎配置创建流程引擎对象的时候会根据配置属性自动部署资源文件了,如下所示
在这里插入图片描述
在这里插入图片描述
org.activiti.spring.SpringProcessEngineConfiguration#autoDeployResources这里采用了策略模式进行部署资源

protected void autoDeployResources(ProcessEngine processEngine) {
    if (deploymentResources != null && deploymentResources.length > 0) {
    	// 获取部署的模式	
        final AutoDeploymentStrategy strategy = getAutoDeploymentStrategy(deploymentMode);
        // 根据模式选择策略进行部署
        strategy.deployResources(deploymentName, deploymentResources, processEngine.getRepositoryService());
    }
}

在默认的策略当中源码如下所示,可以看到支持多种格式。而且最后都是通过资源获取流来部署的。

@Override
public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) {

    // Create a single deployment for all resources using the name hint as the
    // literal name
    final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(deploymentNameHint);

    for (final Resource resource : resources) {
        final String resourceName = determineResourceName(resource);

        try {
            if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
                deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
            } else {
                deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
            }
        } catch (IOException e) {
            throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
        }
    }

    deploymentBuilder.deploy();

}

实际上在Activiti重新启动时,会扫描待自动部署文件,并和已部署文件进行比较,如果发现资源已经部署,并且没有发生过改变,则会忽略不进行重新部署,如果发生了改变,则会进行部署,改变版本号,以和之前部署的资源进行区分。

2021-03-26 15:57:58.821 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- starting StartProcessInstanceCmd --------------------------------------------------------
2021-03-26 15:57:58.824 DEBUG 12828 --- [  restartedMain] p.e.P.selectLatestProcessDefinitionByKey : ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
2021-03-26 15:57:58.824 DEBUG 12828 --- [  restartedMain] p.e.P.selectLatestProcessDefinitionByKey : ==> Parameters: waiter(String), waiter(String)
2021-03-26 15:57:58.829 TRACE 12828 --- [  restartedMain] p.e.P.selectLatestProcessDefinitionByKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 15:57:58.829 TRACE 12828 --- [  restartedMain] p.e.P.selectLatestProcessDefinitionByKey : <==        Row: waiter:4:42506, 1, processDefinitions, null, waiter, 4, 42501, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml, null, null, 0, 0, 1, 
2021-03-26 15:57:58.832 DEBUG 12828 --- [  restartedMain] p.e.P.selectLatestProcessDefinitionByKey : <==      Total: 1
2021-03-26 15:57:58.832 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.D.selectDeploymentById       : ==>  Preparing: select * from ACT_RE_DEPLOYMENT where ID_ = ? 
2021-03-26 15:57:58.833 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.D.selectDeploymentById       : ==> Parameters: 42501(String)
2021-03-26 15:57:58.836 TRACE 12828 --- [  restartedMain] o.a.e.i.p.e.D.selectDeploymentById       : <==    Columns: ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_
2021-03-26 15:57:58.836 TRACE 12828 --- [  restartedMain] o.a.e.i.p.e.D.selectDeploymentById       : <==        Row: 42501, SpringAutoDeployment, null, , 2021-03-25 19:45:41.262
2021-03-26 15:57:58.837 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.D.selectDeploymentById       : <==      Total: 1
2021-03-26 15:57:58.837 DEBUG 12828 --- [  restartedMain] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing deployment SpringAutoDeployment
2021-03-26 15:57:58.837 DEBUG 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : ==>  Preparing: select * from ACT_GE_BYTEARRAY where DEPLOYMENT_ID_ = ? order by NAME_ asc 
2021-03-26 15:57:58.838 DEBUG 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : ==> Parameters: 42501(String)
2021-03-26 15:57:58.841 TRACE 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==    Columns: ID_, REV_, NAME_, DEPLOYMENT_ID_, BYTES_, GENERATED_
2021-03-26 15:57:58.841 TRACE 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==        Row: 42502, 1, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml, 42501, <<BLOB>>, 0
2021-03-26 15:57:58.842 TRACE 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==        Row: 42503, 1, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic2.bpmn, 42501, <<BLOB>>, 0
2021-03-26 15:57:58.842 TRACE 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==        Row: 42504, 1, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.bpmn, 42501, <<BLOB>>, 0
2021-03-26 15:57:58.843 TRACE 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==        Row: 42505, 1, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.reimbursement.png, 42501, <<BLOB>>, 1
2021-03-26 15:57:58.843 DEBUG 12828 --- [  restartedMain] .e.i.p.e.R.selectResourcesByDeploymentId : <==      Total: 4
2021-03-26 15:57:58.844  INFO 12828 --- [  restartedMain] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml
2021-03-26 15:57:58.908 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.handler.ProcessParseHandler  : Parsing process waiter
2021-03-26 15:57:58.909 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity service1
2021-03-26 15:57:58.913 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity start
2021-03-26 15:57:58.916 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity end
2021-03-26 15:57:58.917  INFO 12828 --- [  restartedMain] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic2.bpmn
2021-03-26 15:57:58.918 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.handler.ProcessParseHandler  : Parsing process waiter2
2021-03-26 15:57:58.918 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity service1
2021-03-26 15:57:58.918 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity start
2021-03-26 15:57:58.918 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity end
2021-03-26 15:57:58.919  INFO 12828 --- [  restartedMain] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.bpmn
2021-03-26 15:57:58.924 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.handler.ProcessParseHandler  : Parsing process reimbursement
2021-03-26 15:57:58.924 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity departmentApprove
2021-03-26 15:57:58.941 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity reimburseApprove
2021-03-26 15:57:58.941 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity usertask1
2021-03-26 15:57:58.944 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity startevent1
2021-03-26 15:57:58.944 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity endevent2
2021-03-26 15:57:58.945  INFO 12828 --- [  restartedMain] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.reimbursement.png
2021-03-26 15:57:58.945 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==>  Preparing: select * from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? and KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 15:57:58.945 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==> Parameters: 42501(String), waiter(String)
2021-03-26 15:57:58.948 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 15:57:58.948 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==        Row: waiter:4:42506, 1, processDefinitions, null, waiter, 4, 42501, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml, null, null, 0, 0, 1, 
2021-03-26 15:57:58.949 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==      Total: 1
2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetProcessDefinitionInfoCmd --------------------------------------------------------
2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] o.a.e.i.i.CommandContextInterceptor      : Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- GetProcessDefinitionInfoCmd finished --------------------------------------------------------
2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==>  Preparing: select * from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? and KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 15:57:58.950 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==> Parameters: 42501(String), waiter2(String)
2021-03-26 15:57:58.953 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 15:57:58.953 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==        Row: waiter2:4:42507, 1, processDefinitions, null, waiter2, 4, 42501, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic2.bpmn, null, null, 0, 0, 1, 
2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==      Total: 1
2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetProcessDefinitionInfoCmd --------------------------------------------------------
2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] o.a.e.i.i.CommandContextInterceptor      : Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- GetProcessDefinitionInfoCmd finished --------------------------------------------------------
2021-03-26 15:57:58.954 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.955 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==>  Preparing: select * from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? and KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 15:57:58.955 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : ==> Parameters: 42501(String), reimbursement(String)
2021-03-26 15:57:58.958 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 15:57:58.958 TRACE 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==        Row: reimbursement:2:42508, 1, http://www.zioer.com/reimbursement, 费用报销, reimbursement, 2, 42501, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.bpmn, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.reimbursement.png, 公司费用报销简易流程, 0, 1, 1, 
2021-03-26 15:57:58.960 DEBUG 12828 --- [  restartedMain] electProcessDefinitionByDeploymentAndKey : <==      Total: 1
2021-03-26 15:57:58.960 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.961 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetProcessDefinitionInfoCmd --------------------------------------------------------
2021-03-26 15:57:58.961 DEBUG 12828 --- [  restartedMain] o.a.e.i.i.CommandContextInterceptor      : Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
2021-03-26 15:57:58.961 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- GetProcessDefinitionInfoCmd finished --------------------------------------------------------
2021-03-26 15:57:58.961 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.961 DEBUG 12828 --- [  restartedMain] .a.e.i.p.e.P.selectProcessDefinitionById : ==>  Preparing: select * from ACT_RE_PROCDEF where ID_ = ? 
2021-03-26 15:57:58.962 DEBUG 12828 --- [  restartedMain] .a.e.i.p.e.P.selectProcessDefinitionById : ==> Parameters: waiter:4:42506(String)
2021-03-26 15:57:58.964 TRACE 12828 --- [  restartedMain] .a.e.i.p.e.P.selectProcessDefinitionById : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 15:57:58.964 TRACE 12828 --- [  restartedMain] .a.e.i.p.e.P.selectProcessDefinitionById : <==        Row: waiter:4:42506, 1, processDefinitions, null, waiter, 4, 42501, E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml, null, null, 0, 0, 1, 
2021-03-26 15:57:58.965 DEBUG 12828 --- [  restartedMain] .a.e.i.p.e.P.selectProcessDefinitionById : <==      Total: 1
2021-03-26 15:57:58.967 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.967 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetNextIdBlockCmd --------------------------------------------------------
2021-03-26 15:57:58.969 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.selectProperty             : ==>  Preparing: select * from ACT_GE_PROPERTY where NAME_ = ? 
2021-03-26 15:57:58.969 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.selectProperty             : ==> Parameters: next.dbid(String)
2021-03-26 15:57:58.971 TRACE 12828 --- [  restartedMain] o.a.e.i.p.e.P.selectProperty             : <==    Columns: NAME_, VALUE_, REV_
2021-03-26 15:57:58.971 TRACE 12828 --- [  restartedMain] o.a.e.i.p.e.P.selectProperty             : <==        Row: next.dbid, 52501, 22
2021-03-26 15:57:58.972 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.selectProperty             : <==      Total: 1
2021-03-26 15:57:58.973 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   update PropertyEntity[name=next.dbid, value=55001]
2021-03-26 15:57:58.973 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : flush summary: 0 insert, 1 update, 0 delete.
2021-03-26 15:57:58.973 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : now executing flush...
2021-03-26 15:57:58.973 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : updating: PropertyEntity[name=next.dbid, value=55001]
2021-03-26 15:57:58.975 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.updateProperty             : ==>  Preparing: update ACT_GE_PROPERTY SET REV_ = ?, VALUE_ = ? where NAME_ = ? and REV_ = ? 
2021-03-26 15:57:58.976 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.updateProperty             : ==> Parameters: 23(Integer), 55001(String), next.dbid(String), 22(Integer)
2021-03-26 15:57:58.981 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.P.updateProperty             : <==    Updates: 1
2021-03-26 15:57:58.991 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- GetNextIdBlockCmd finished --------------------------------------------------------
2021-03-26 15:57:58.991 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 15:57:58.991 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.entity.ExecutionEntity         : initializing ProcessInstance[52501]
2021-03-26 15:57:58.994 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:58.996 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:58.996 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: FULL
2021-03-26 15:57:59.006 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStart@2d19ba23 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.008 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStartInitial@3dedf1c on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.008 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@38fa100d on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.008 DEBUG 12828 --- [  restartedMain] a.e.i.p.r.AtomicOperationActivityExecute : ProcessInstance[52501] executes Activity(start): org.activiti.engine.impl.bpmn.behavior.NoneStartEventActivityBehavior
2021-03-26 15:57:59.011 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.J.selectJobsByExecutionId    : ==>  Preparing: select * from ACT_RU_JOB J where J.EXECUTION_ID_ = ? 
2021-03-26 15:57:59.011 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.J.selectJobsByExecutionId    : ==> Parameters: 52501(String)
2021-03-26 15:57:59.015 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.J.selectJobsByExecutionId    : <==      Total: 0
2021-03-26 15:57:59.017 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.behavior.BpmnActivityBehavior  : Leaving activity 'start'
2021-03-26 15:57:59.018 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@79f92745 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.018 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.018 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@79f92745 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.018 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope@7b962ec0 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.018 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake@2797290e on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.019 DEBUG 12828 --- [  restartedMain] micOperationTransitionNotifyListenerTake : ProcessInstance[52501] takes transition (start)--flow1-->(service1)
2021-03-26 15:57:59.020 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope@388be9ec on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.020 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@46897afe on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.020 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.020 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@46897afe on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.020 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@38fa100d on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.020 DEBUG 12828 --- [  restartedMain] a.e.i.p.r.AtomicOperationActivityExecute : ProcessInstance[52501] executes Activity(service1): org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior
customerId=243
2021-03-26 15:57:59.271 DEBUG 12828 --- [  restartedMain] o.a.e.i.b.behavior.BpmnActivityBehavior  : Leaving activity 'service1'
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@79f92745 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.271 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@79f92745 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope@7b962ec0 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake@2797290e on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.271 DEBUG 12828 --- [  restartedMain] micOperationTransitionNotifyListenerTake : ProcessInstance[52501] takes transition (service1)--flow2-->(end)
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope@388be9ec on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.271 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@46897afe on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.272 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.272 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@46897afe on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.272 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@38fa100d on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.272 DEBUG 12828 --- [  restartedMain] a.e.i.p.r.AtomicOperationActivityExecute : ProcessInstance[52501] executes Activity(end): org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior
2021-03-26 15:57:59.272 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityEnd@30006bb1 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.272 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.272 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityEnd@30006bb1 on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.273 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd@cf9d8ba on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.273 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.273 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT
2021-03-26 15:57:59.273 TRACE 12828 --- [  restartedMain] o.a.e.impl.interceptor.CommandContext    : AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd@cf9d8ba on org.activiti.engine.impl.interceptor.CommandContext@357abc4d
2021-03-26 15:57:59.273 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.entity.ExecutionEntity         : destroying ProcessInstance[52501]
2021-03-26 15:57:59.274 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.275 DEBUG 12828 --- [  restartedMain] o.a.e.i.history.DefaultHistoryManager    : Current history level: AUDIT, level required: ACTIVITY
2021-03-26 15:57:59.276 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : skipping redundant delete: VariableInstanceEntity[id=52503, name=customerId, type=long, longValue=243, textValue=243]
2021-03-26 15:57:59.276 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.T.selectTasksByExecutionId   : ==>  Preparing: select distinct T.* from ACT_RU_TASK T where T.EXECUTION_ID_ = ? 
2021-03-26 15:57:59.276 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.T.selectTasksByExecutionId   : ==> Parameters: 52501(String)
2021-03-26 15:57:59.281 DEBUG 12828 --- [  restartedMain] o.a.e.i.p.e.T.selectTasksByExecutionId   : <==      Total: 0
2021-03-26 15:57:59.283 DEBUG 12828 --- [  restartedMain] e.I.selectIdentityLinksByProcessInstance : ==>  Preparing: select * from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = ? 
2021-03-26 15:57:59.283 DEBUG 12828 --- [  restartedMain] e.I.selectIdentityLinksByProcessInstance : ==> Parameters: 52501(String)
2021-03-26 15:57:59.286 DEBUG 12828 --- [  restartedMain] e.I.selectIdentityLinksByProcessInstance : <==      Total: 0
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ProcessDefinitionEntity[waiter2:4:42507]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ProcessDefinitionEntity[waiter:4:42506]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ProcessDefinitionEntity[reimbursement:2:42508]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'DeploymentEntity[id=42501, name=SpringAutoDeployment]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ResourceEntity[id=42505, name=E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.reimbursement.png]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ResourceEntity[id=42502, name=E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic.bpmn20.xml]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ResourceEntity[id=42503, name=E:\20200702\xquant-platform-component-test-ext\target\classes\processes\basic2.bpmn]' was not updated
2021-03-26 15:57:59.287 TRACE 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ResourceEntity[id=42504, name=E:\20200702\xquant-platform-component-test-ext\target\classes\processes\reimbursement.bpmn]' was not updated
2021-03-26 15:57:59.287 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   insert HistoricVariableInstanceEntity[id=52503, name=customerId, revision=0, type=long, longValue=243, textValue=243]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   insert HistoricProcessInstanceEntity[superProcessInstanceId=null]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   insert HistoricActivityInstanceEntity[activityId=start, activityName=null]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   insert HistoricActivityInstanceEntity[activityId=service1, activityName=null]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   :   insert HistoricActivityInstanceEntity[activityId=end, activityName=null]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : flush summary: 5 insert, 0 update, 0 delete.
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : now executing flush...
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : inserting: HistoricVariableInstanceEntity[id=52503, name=customerId, revision=0, type=long, longValue=243, textValue=243]
2021-03-26 15:57:59.288 DEBUG 12828 --- [  restartedMain] e.i.p.e.H.insertHistoricVariableInstance : ==>  Preparing: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
2021-03-26 15:57:59.289 DEBUG 12828 --- [  restartedMain] e.i.p.e.H.insertHistoricVariableInstance : ==> Parameters: 52503(String), 52501(String), 52501(String), null, customerId(String), 0(Integer), long(String), null, null, 243(Long), 243(String), null, 2021-03-26 15:57:58.996(Timestamp), 2021-03-26 15:57:59.275(Timestamp)
2021-03-26 15:57:59.293 DEBUG 12828 --- [  restartedMain] e.i.p.e.H.insertHistoricVariableInstance : <==    Updates: 1
2021-03-26 15:57:59.293 DEBUG 12828 --- [  restartedMain] o.activiti.engine.impl.db.DbSqlSession   : inserting: HistoricProcessInstanceEntity[superProcessInstanceId=null]
2021-03-26 15:57:59.293 DEBUG 12828 --- [  restartedMain] .e.i.p.e.H.insertHistoricProcessInstance : ==>  Preparing: insert into ACT_HI_PROCINST ( ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, DURATION_, START_USER_ID_, START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, DELETE_REASON_, TENANT_ID_, NAME_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
2021-03-26 15:57:59.296 DEBUG 12828 --- [  restartedMain] .e.i.p.e.H.insertHistoricProcessInstance : ==> Parameters: 52501(String), 52501(String), null, waiter:4:42506(String), 2021-03-26 15:57:58.994(Timestamp), 2021-03-26 15:57:59.273(Timestamp), 279(Long), null, start(String), end(String), null, null, (String), null
2021-03-26 15:57:59.300 DEBUG 12828 --- [  restartedMain] .e.i.p.e.H.insertHistoricProcessInstance : <==    Updates: 1
2021-03-26 15:57:59.329 DEBUG 12828 --- [  restartedMain] p.e.H.bulkInsertHistoricActivityInstance : ==>  Preparing: insert into ACT_HI_ACTINST ( ID_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, ACT_NAME_, ACT_TYPE_, ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, TENANT_ID_ ) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
2021-03-26 15:57:59.333 DEBUG 12828 --- [  restartedMain] p.e.H.bulkInsertHistoricActivityInstance : ==> Parameters: 52502(String), waiter:4:42506(String), 52501(String), 52501(String), start(String), null, null, null, startEvent(String), null, 2021-03-26 15:57:58.996(Timestamp), 2021-03-26 15:57:59.018(Timestamp), 22(Long), (String), 52504(String), waiter:4:42506(String), 52501(String), 52501(String), service1(String), null, null, null, scriptTask(String), null, 2021-03-26 15:57:59.02(Timestamp), 2021-03-26 15:57:59.271(Timestamp), 251(Long), (String), 52505(String), waiter:4:42506(String), 52501(String), 52501(String), end(String), null, null, null, endEvent(String), null, 2021-03-26 15:57:59.272(Timestamp), 2021-03-26 15:57:59.272(Timestamp), 0(Long), (String)
2021-03-26 15:57:59.338 DEBUG 12828 --- [  restartedMain] p.e.H.bulkInsertHistoricActivityInstance : <==    Updates: 3
2021-03-26 15:57:59.347 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : --- StartProcessInstanceCmd finished --------------------------------------------------------
2021-03-26 15:57:59.347 DEBUG 12828 --- [  restartedMain] o.a.e.impl.interceptor.LogInterceptor    : 

部署完成之后可以在数据库中查看相关的记录

-- 部署对象数据表
SELECT * FROM ACT_RE_DEPLOYMENT;
-- 流程定义表
SELECT * FROM ACT_RE_PROCDEF ORDER BY DEPLOYMENT_ID_ DESC;
-- 资源文件表
SELECT * FROM ACT_GE_BYTEARRAY ORDER BY DEPLOYMENT_ID_ DESC;

部署对象数据表
在这里插入图片描述
流程定义表
在这里插入图片描述
资源文件表
在这里插入图片描述

classpath部署

通过repositoryService的addClasspathResource可以指定classpath下面的资源进行部署。

    @RequestMapping(value = "/depclasspath")
    public String deployementProDef(){  
    	Deployment dep = repositoryService.createDeployment()
    			.name("reimbursement")
    			.category("yourCategory")
    			.tenantId("dfdfe32fsdfsdfsf")
    			.addClasspathResource("workflow/reimbursement/reimbursement.bpmn").deploy();

        System.out.println("部署ID:"+dep.getId());//1  
        System.out.println("部署时间:"+dep.getDeploymentTime());  
        
        return "redirect:list";
    }  

输入流部署

调用addInputStream方法,输入流的来源有多种,可以是本地计算机、classpath资源或者网络方式读取。

/**
 * 输入流部署
 * @return
 */
@RequestMapping(value = "/depinputstream")
public String deployementProDefByInS() throws FileNotFoundException{  
    //获取资源相对路径  
    String bpmnPath = "D:/reimbursement.bpmn";
      
    //读取资源作为一个输入流  
    FileInputStream bpmnfileInputStream = new FileInputStream(bpmnPath);  
      
    Deployment deployment = repositoryService.createDeployment()
                    .name("reimbursement") 
                    .addInputStream("reimbursement.bpmn",bpmnfileInputStream)  
                    .deploy();//完成部署  
    System.out.println("部署ID:"+deployment.getId());//1  
    System.out.println("部署时间:"+deployment.getDeploymentTime());  
    
    return "redirect:list";
} 

日志如下

2021-03-26 17:19:01.857 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : --- starting DeployCmd --------------------------------------------------------
2021-03-26 17:19:01.862 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing deployment reimbursement
2021-03-26 17:19:01.862  INFO 11232 --- [io-8080-exec-10] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource reimbursement.bpmn
2021-03-26 17:19:02.126 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.handler.ProcessParseHandler  : Parsing process reimbursement
2021-03-26 17:19:02.126 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity departmentApprove
2021-03-26 17:19:02.126 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity reimburseApprove
2021-03-26 17:19:02.127 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity usertask1
2021-03-26 17:19:02.127 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity startevent1
2021-03-26 17:19:02.127 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity endevent2
2021-03-26 17:19:02.706 DEBUG 11232 --- [io-8080-exec-10] p.e.P.selectLatestProcessDefinitionByKey : ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
2021-03-26 17:19:02.706 DEBUG 11232 --- [io-8080-exec-10] p.e.P.selectLatestProcessDefinitionByKey : ==> Parameters: reimbursement(String), reimbursement(String)
2021-03-26 17:19:02.709 TRACE 11232 --- [io-8080-exec-10] p.e.P.selectLatestProcessDefinitionByKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 17:19:02.709 TRACE 11232 --- [io-8080-exec-10] p.e.P.selectLatestProcessDefinitionByKey : <==        Row: reimbursement:3:50012, 1, http://www.zioer.com/reimbursement, 费用报销, reimbursement, 3, 50009, reimbursement.bpmn, reimbursement.reimbursement.png, 公司费用报销简易流程, 0, 1, 1, 
2021-03-26 17:19:02.710 DEBUG 11232 --- [io-8080-exec-10] p.e.P.selectLatestProcessDefinitionByKey : <==      Total: 1
2021-03-26 17:19:02.711 DEBUG 11232 --- [io-8080-exec-10] bByTypeAndProcessDefinitionKeyNoTenantId : ==>  Preparing: select J.* from ACT_RU_JOB J inner join ACT_RE_PROCDEF P on J.PROC_DEF_ID_ = P.ID_ where J.HANDLER_TYPE_ = ? and P.KEY_ = ? and (P.TENANT_ID_ = '' or P.TENANT_ID_ is null) 
2021-03-26 17:19:02.711 DEBUG 11232 --- [io-8080-exec-10] bByTypeAndProcessDefinitionKeyNoTenantId : ==> Parameters: timer-start-event(String), reimbursement(String)
2021-03-26 17:19:02.713 DEBUG 11232 --- [io-8080-exec-10] bByTypeAndProcessDefinitionKeyNoTenantId : <==      Total: 0
2021-03-26 17:19:02.731 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : ==>  Preparing: select * from ACT_RU_EVENT_SUBSCR WHERE (EVENT_TYPE_ = ?) and PROC_DEF_ID_ = ? and EXECUTION_ID_ is null and PROC_INST_ID_ is null and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 17:19:02.732 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : ==> Parameters: message(String), reimbursement:3:50012(String)
2021-03-26 17:19:02.735 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : <==      Total: 0
2021-03-26 17:19:02.737 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : ==>  Preparing: select * from ACT_RU_EVENT_SUBSCR WHERE (EVENT_TYPE_ = ?) and PROC_DEF_ID_ = ? and EXECUTION_ID_ is null and PROC_INST_ID_ is null and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 17:19:02.737 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : ==> Parameters: signal(String), reimbursement:3:50012(String)
2021-03-26 17:19:02.739 DEBUG 11232 --- [io-8080-exec-10] ubscriptionsByTypeAndProcessDefinitionId : <==      Total: 0
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetProcessDefinitionInfoCmd --------------------------------------------------------
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.i.CommandContextInterceptor      : Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : --- GetProcessDefinitionInfoCmd finished --------------------------------------------------------
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 17:19:02.741 TRACE 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ProcessDefinitionEntity[reimbursement:3:50012]' was not updated
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   :   insert ProcessDefinitionEntity[reimbursement:4:55009]
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   :   insert DeploymentEntity[id=55006, name=reimbursement]
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   :   insert ResourceEntity[id=55007, name=reimbursement.bpmn]
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   :   insert ResourceEntity[id=55008, name=reimbursement.reimbursement.png]
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   : flush summary: 4 insert, 0 update, 0 delete.
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   : now executing flush...
2021-03-26 17:19:02.741 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   : inserting: ProcessDefinitionEntity[reimbursement:4:55009]
2021-03-26 17:19:02.742 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.P.insertProcessDefinition    : ==>  Preparing: insert into ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
2021-03-26 17:19:02.743 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.P.insertProcessDefinition    : ==> Parameters: reimbursement:4:55009(String), http://www.zioer.com/reimbursement(String), 费用报销(String), reimbursement(String), 4(Integer), 55006(String), reimbursement.bpmn(String), reimbursement.reimbursement.png(String), 公司费用报销简易流程(String), false(Boolean), true(Boolean), 1(Integer), (String)
2021-03-26 17:19:02.746 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.P.insertProcessDefinition    : <==    Updates: 1
2021-03-26 17:19:02.747 DEBUG 11232 --- [io-8080-exec-10] o.activiti.engine.impl.db.DbSqlSession   : inserting: DeploymentEntity[id=55006, name=reimbursement]
2021-03-26 17:19:02.747 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.D.insertDeployment           : ==>  Preparing: insert into ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_) values(?, ?, ?, ?, ?) 
2021-03-26 17:19:02.747 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.D.insertDeployment           : ==> Parameters: 55006(String), reimbursement(String), null, (String), 2021-03-26 17:19:01.862(Timestamp)
2021-03-26 17:19:02.750 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.D.insertDeployment           : <==    Updates: 1
2021-03-26 17:19:02.751 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.R.bulkInsertResource         : ==>  Preparing: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) 
2021-03-26 17:19:02.751 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.R.bulkInsertResource         : ==> Parameters: 55007(String), reimbursement.bpmn(String), java.io.ByteArrayInputStream@15d92922(ByteArrayInputStream), 55006(String), false(Boolean), 55008(String), reimbursement.reimbursement.png(String), java.io.ByteArrayInputStream@19551ec(ByteArrayInputStream), 55006(String), true(Boolean)
2021-03-26 17:19:02.761 DEBUG 11232 --- [io-8080-exec-10] o.a.e.i.p.e.R.bulkInsertResource         : <==    Updates: 2
2021-03-26 17:19:02.767 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : --- DeployCmd finished --------------------------------------------------------
2021-03-26 17:19:02.767 DEBUG 11232 --- [io-8080-exec-10] o.a.e.impl.interceptor.LogInterceptor    : 

部署ID:55006
部署时间:Fri Mar 26 17:19:01 CST 2021
2021-03-26 17:19:02.784 DEBUG 11232 --- [nio-8080-exec-1] o.a.e.impl.interceptor.LogInterceptor    : 

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

zip/bar部署

/**
 * 压缩包部署
 * @return
 */
@RequestMapping(value = "/depzip")
public String deployementProDefByZIP() throws FileNotFoundException{  
    //获取资源相对路径  
    String zipPath = "d:/reimbursement.zip";  
    File f = new File(zipPath);   
    InputStream in = new FileInputStream(f);
    
    InputStream ins = this.getClass().getClassLoader().getResourceAsStream("diagrams/helloworld.zip");  
    
    //读取资源作为一个输入流  
    ZipInputStream zipfileInputStream = new ZipInputStream(in);  
      
    Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                    .name("reimbursement") 
                    .addZipInputStream(zipfileInputStream)
                    .deploy();//完成部署  
    System.out.println("部署ID:"+deployment.getId());//1  
    System.out.println("部署时间:"+deployment.getDeploymentTime());  
    
    return "redirect:list";
}  

对应的日志如下所示

2021-03-26 17:23:00.481 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 17:23:00.481 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : --- starting DeployCmd --------------------------------------------------------
2021-03-26 17:23:00.483 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing deployment reimbursement
2021-03-26 17:23:00.483  INFO 11232 --- [nio-8080-exec-7] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Processing resource reimbursement.bpmn
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.handler.ProcessParseHandler  : Parsing process reimbursement
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity departmentApprove
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity reimburseApprove
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity usertask1
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity startevent1
2021-03-26 17:23:00.534 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.b.p.h.AbstractBpmnParseHandler   : Parsing activity endevent2
2021-03-26 17:23:00.734 DEBUG 11232 --- [nio-8080-exec-7] p.e.P.selectLatestProcessDefinitionByKey : ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
2021-03-26 17:23:00.734 DEBUG 11232 --- [nio-8080-exec-7] p.e.P.selectLatestProcessDefinitionByKey : ==> Parameters: reimbursement(String), reimbursement(String)
2021-03-26 17:23:00.737 TRACE 11232 --- [nio-8080-exec-7] p.e.P.selectLatestProcessDefinitionByKey : <==    Columns: ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_, SUSPENSION_STATE_, TENANT_ID_
2021-03-26 17:23:00.737 TRACE 11232 --- [nio-8080-exec-7] p.e.P.selectLatestProcessDefinitionByKey : <==        Row: reimbursement:4:55009, 1, http://www.zioer.com/reimbursement, 费用报销, reimbursement, 4, 55006, reimbursement.bpmn, reimbursement.reimbursement.png, 公司费用报销简易流程, 0, 1, 1, 
2021-03-26 17:23:00.738 DEBUG 11232 --- [nio-8080-exec-7] p.e.P.selectLatestProcessDefinitionByKey : <==      Total: 1
2021-03-26 17:23:00.738 DEBUG 11232 --- [nio-8080-exec-7] bByTypeAndProcessDefinitionKeyNoTenantId : ==>  Preparing: select J.* from ACT_RU_JOB J inner join ACT_RE_PROCDEF P on J.PROC_DEF_ID_ = P.ID_ where J.HANDLER_TYPE_ = ? and P.KEY_ = ? and (P.TENANT_ID_ = '' or P.TENANT_ID_ is null) 
2021-03-26 17:23:00.738 DEBUG 11232 --- [nio-8080-exec-7] bByTypeAndProcessDefinitionKeyNoTenantId : ==> Parameters: timer-start-event(String), reimbursement(String)
2021-03-26 17:23:00.741 DEBUG 11232 --- [nio-8080-exec-7] bByTypeAndProcessDefinitionKeyNoTenantId : <==      Total: 0
2021-03-26 17:23:00.742 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : ==>  Preparing: select * from ACT_RU_EVENT_SUBSCR WHERE (EVENT_TYPE_ = ?) and PROC_DEF_ID_ = ? and EXECUTION_ID_ is null and PROC_INST_ID_ is null and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 17:23:00.742 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : ==> Parameters: message(String), reimbursement:4:55009(String)
2021-03-26 17:23:00.744 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : <==      Total: 0
2021-03-26 17:23:00.745 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : ==>  Preparing: select * from ACT_RU_EVENT_SUBSCR WHERE (EVENT_TYPE_ = ?) and PROC_DEF_ID_ = ? and EXECUTION_ID_ is null and PROC_INST_ID_ is null and (TENANT_ID_ = '' or TENANT_ID_ is null) 
2021-03-26 17:23:00.745 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : ==> Parameters: signal(String), reimbursement:4:55009(String)
2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] ubscriptionsByTypeAndProcessDefinitionId : <==      Total: 0
2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : --- starting GetProcessDefinitionInfoCmd --------------------------------------------------------
2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.i.CommandContextInterceptor      : Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : --- GetProcessDefinitionInfoCmd finished --------------------------------------------------------
2021-03-26 17:23:00.747 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : 

2021-03-26 17:23:00.748 TRACE 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   : loaded object 'ProcessDefinitionEntity[reimbursement:4:55009]' was not updated
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   :   insert ProcessDefinitionEntity[reimbursement:5:55013]
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   :   insert DeploymentEntity[id=55010, name=reimbursement]
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   :   insert ResourceEntity[id=55011, name=reimbursement.bpmn]
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   :   insert ResourceEntity[id=55012, name=reimbursement.reimbursement.png]
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   : flush summary: 4 insert, 0 update, 0 delete.
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   : now executing flush...
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   : inserting: ProcessDefinitionEntity[reimbursement:5:55013]
2021-03-26 17:23:00.748 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.P.insertProcessDefinition    : ==>  Preparing: insert into ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
2021-03-26 17:23:00.749 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.P.insertProcessDefinition    : ==> Parameters: reimbursement:5:55013(String), http://www.zioer.com/reimbursement(String), 费用报销(String), reimbursement(String), 5(Integer), 55010(String), reimbursement.bpmn(String), reimbursement.reimbursement.png(String), 公司费用报销简易流程(String), false(Boolean), true(Boolean), 1(Integer), (String)
2021-03-26 17:23:00.753 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.P.insertProcessDefinition    : <==    Updates: 1
2021-03-26 17:23:00.753 DEBUG 11232 --- [nio-8080-exec-7] o.activiti.engine.impl.db.DbSqlSession   : inserting: DeploymentEntity[id=55010, name=reimbursement]
2021-03-26 17:23:00.753 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.D.insertDeployment           : ==>  Preparing: insert into ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_) values(?, ?, ?, ?, ?) 
2021-03-26 17:23:00.754 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.D.insertDeployment           : ==> Parameters: 55010(String), reimbursement(String), null, (String), 2021-03-26 17:23:00.483(Timestamp)
2021-03-26 17:23:00.756 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.D.insertDeployment           : <==    Updates: 1
2021-03-26 17:23:00.756 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.R.bulkInsertResource         : ==>  Preparing: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) 
2021-03-26 17:23:00.757 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.R.bulkInsertResource         : ==> Parameters: 55011(String), reimbursement.bpmn(String), java.io.ByteArrayInputStream@56f8bacc(ByteArrayInputStream), 55010(String), false(Boolean), 55012(String), reimbursement.reimbursement.png(String), java.io.ByteArrayInputStream@666255a2(ByteArrayInputStream), 55010(String), true(Boolean)
2021-03-26 17:23:00.763 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.i.p.e.R.bulkInsertResource         : <==    Updates: 2
2021-03-26 17:23:00.771 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : --- DeployCmd finished --------------------------------------------------------
2021-03-26 17:23:00.771 DEBUG 11232 --- [nio-8080-exec-7] o.a.e.impl.interceptor.LogInterceptor    : 

部署ID:55010
部署时间:Fri Mar 26 17:23:00 CST 2021
2021-03-26 17:23:00.780 DEBUG 11232 --- [nio-8080-exec-8] o.a.e.impl.interceptor.LogInterceptor    : 

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

动态BPMN模型部署

/**
 * 动态BPMN部署
 * @return
 */
@RequestMapping(value = "/depbpmnmodel")
public String deployementProDefByBPMN() {  
	
	BpmnModel bpmnModel=new BpmnModel();  
	StartEvent startEvent=new StartEvent();  
	startEvent.setId("start1");  
	startEvent.setName("动态创建开始节点");  
	UserTask userTask=new UserTask();  
	userTask.setId("userTask1");  
	userTask.setName("用户任务节点1");  
	EndEvent endEvent=new EndEvent();  
	endEvent.setId("endEvent1");  
	endEvent.setName("动态创建结束节点");  
	List<SequenceFlow> sequenceFlows=new ArrayList<SequenceFlow>();  
	List<SequenceFlow> toEnd=new ArrayList<SequenceFlow>();  
	SequenceFlow s1=new SequenceFlow();  
	s1.setId("sequenceFlow1");  
	s1.setName("开始节点指向用户任务节点");  
	s1.setSourceRef("start1");  
	s1.setTargetRef("userTask1");  
	sequenceFlows.add(s1);  
	SequenceFlow s2=new SequenceFlow();  
	s2.setId("sequenceFlow2");  
	s2.setName("用户任务节点指向结束节点");  
	s2.setSourceRef("userTask1");  
	s2.setTargetRef("endEvent1");  
	toEnd.add(s2);  
	
	startEvent.setOutgoingFlows(sequenceFlows);  
	userTask.setOutgoingFlows(toEnd);  
	userTask.setIncomingFlows(sequenceFlows);  
	endEvent.setIncomingFlows(toEnd);  
	
	Process process=new Process();  
	process.setId("process1");  
	process.setName("test");
	process.addFlowElement(startEvent);  
	process.addFlowElement(s1);  
	process.addFlowElement(userTask);  
	process.addFlowElement(s2);  
	process.addFlowElement(endEvent);  
	bpmnModel.addProcess(process);  
	
	new BpmnAutoLayout(bpmnModel).execute();
	
    Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                    .name("reimbursement") 
                    .addBpmnModel("dynamic-model.bpmn", bpmnModel)
                    .deploy();//完成部署  
    System.out.println("部署ID:"+deployment.getId());//1  
    System.out.println("部署时间:"+deployment.getDeploymentTime());  
    
    return "redirect:list";
}  

还有字符串部署,直接调用addString就可以,此处不详细介绍了。

由于要生成PNG文件,需要引入依赖

<dependency>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-bpmn-layout</artifactId>
    <version>${activiti.version}</version>
    <exclusions>
        <exclusion>
            <artifactId>jackson-core</artifactId>
            <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
            <artifactId>jackson-databind</artifactId>
            <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
    </exclusions>
</dependency>

创建一个ProcessController用于流程部署的增删改查操作

package com.xquant.platform.test.activiti.controller;

import org.activiti.bpmn.BpmnAutoLayout;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.*;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipInputStream;


@Controller
@RequestMapping(value = "/process")
public class ProcessController {
    @Autowired
    private RepositoryService repositoryService;
    
    
    /**
	 * 流程列表
	 */
	@RequestMapping(value="/list")
	public ModelAndView listdeployed(HttpServletRequest request){
		
		ModelAndView mv = new ModelAndView();

		long pageSize = 10;
    	long page = 0 ;
    	long totalPage = 0;
    	long totalRows = 0;
    	
    	long firstResult;	//查询的起始记录数
    	long maxResults = pageSize; //查询的每页显示记录数
    	
    	ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
        
		totalRows = processDefinitionQuery.count();
        if ( totalRows % pageSize == 0){
    		totalPage = totalRows / pageSize;
    	}else{
    		totalPage = totalRows / pageSize + 1;
    	}
    	
    	if (request.getParameter("page") == null){
    		page = 1;
    	}else{
    		if (Integer.parseInt(request.getParameter("page"))<1) {
				page = 1;
			} else if (Integer.parseInt(request.getParameter("page")) > totalPage) {
				page = totalPage;
			} else {
				page = Integer.parseInt(request.getParameter("page"));
			}
    	}
    	
    	firstResult = pageSize * (page - 1);
    	
    	List<ProcessDefinition> list = processDefinitionQuery.listPage((int)firstResult, (int)maxResults );
    	
        mv.setViewName("process_list");
        mv.addObject("currentPage", page);
        mv.addObject("totalPage", totalPage);
    	
    	mv.addObject("data", list);
    	
		return mv;
	}
    
	@RequestMapping(value = "/add")
    public String add() {
    	return "process_add";
    }
	
	@RequestMapping({"/uplaod_save"})
	public String uploadDeployedsave( @RequestParam(value="upFile", required=false) MultipartFile[] files) throws IOException{
		String fileOriginalname;
			
    	if(files!=null&&files.length>0){  
            //循环获取file数组中得文件  
            for(int i = 0;i<files.length;i++){  
                MultipartFile file = files[i]; 	            
                fileOriginalname = file.getOriginalFilename();
                
                String extension = FilenameUtils.getExtension(fileOriginalname);
                
                InputStream fileInputStream = file.getInputStream();
                
                if (extension.equals("zip") || extension.equals("bar")) {
                    ZipInputStream zip = new ZipInputStream(fileInputStream);
                    repositoryService.createDeployment().addZipInputStream(zip).deploy();
                } else {
                    repositoryService.createDeployment().addInputStream(fileOriginalname, fileInputStream).deploy();
                }
                
                
            }  
        }
    	
    	return "redirect:list/";
        
    }

	@RequestMapping(value = "/delete/{deploymentId}")
	public String deleteDeployed(@PathVariable String deploymentId) {
		
		try {
			repositoryService.deleteDeployment(deploymentId);
			//级联删除:同时删除启动的流程,删除和当前规则相关的所有信息,正在执行的流程,包括历史信息
			//repositoryService.deleteDeployment(deploymentId, true);
		} catch (Exception e) {
			
		} 

		return "redirect:list/";
    }
	
	/**
     * 读取资源,通过部署ID
     */
    @RequestMapping(value = "/resource/read")
    public void readDep(@RequestParam("processDefinitionId") String processDefinitionId, @RequestParam("reType") String reType,
                                 HttpServletResponse response) throws Exception {
        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
        String resourceName = "";
        if (reType.equals("image")) {
            resourceName = processDefinition.getDiagramResourceName();
        } else if (reType.equals("xml")) {
            resourceName = processDefinition.getResourceName();
        }
        
        InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
        byte[] b = new byte[1024];
        int len = -1;
        while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
            response.getOutputStream().write(b, 0, len);
        }
    }
    
    /**
     * 动态BPMN部署
     * @return
     */
    @RequestMapping(value = "/depbpmnmodel")
	public String deployementProDefByBPMN() {  
    	
    	BpmnModel bpmnModel=new BpmnModel();  
    	StartEvent startEvent=new StartEvent();  
    	startEvent.setId("start1");  
    	startEvent.setName("动态创建开始节点");  
    	UserTask userTask=new UserTask();  
    	userTask.setId("userTask1");  
    	userTask.setName("用户任务节点1");  
    	EndEvent endEvent=new EndEvent();  
    	endEvent.setId("endEvent1");  
    	endEvent.setName("动态创建结束节点");  
    	List<SequenceFlow> sequenceFlows=new ArrayList<SequenceFlow>();  
    	List<SequenceFlow> toEnd=new ArrayList<SequenceFlow>();  
    	SequenceFlow s1=new SequenceFlow();  
    	s1.setId("sequenceFlow1");  
    	s1.setName("开始节点指向用户任务节点");  
    	s1.setSourceRef("start1");  
    	s1.setTargetRef("userTask1");  
    	sequenceFlows.add(s1);  
    	SequenceFlow s2=new SequenceFlow();  
    	s2.setId("sequenceFlow2");  
    	s2.setName("用户任务节点指向结束节点");  
    	s2.setSourceRef("userTask1");  
    	s2.setTargetRef("endEvent1");  
    	toEnd.add(s2);  
    	
    	startEvent.setOutgoingFlows(sequenceFlows);  
    	userTask.setOutgoingFlows(toEnd);  
    	userTask.setIncomingFlows(sequenceFlows);  
    	endEvent.setIncomingFlows(toEnd);  
    	
    	Process process=new Process();  
    	process.setId("process1");  
    	process.setName("test");
    	process.addFlowElement(startEvent);  
    	process.addFlowElement(s1);  
    	process.addFlowElement(userTask);  
    	process.addFlowElement(s2);  
    	process.addFlowElement(endEvent);  
    	bpmnModel.addProcess(process);  
    	
    	new BpmnAutoLayout(bpmnModel).execute();
    	
        Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                        .name("reimbursement") 
                        .addBpmnModel("dynamic-model.bpmn", bpmnModel)
                        .deploy();//完成部署  
        System.out.println("部署ID:"+deployment.getId());//1  
        System.out.println("部署时间:"+deployment.getDeploymentTime());  
        
        return "redirect:list";
    }  
	
    /**
     * Classpath部署
     * @return
     */
    @RequestMapping(value = "/depclasspath")
    public String deployementProDef(){  
    	Deployment dep = repositoryService.createDeployment()
    			.name("reimbursement")
    			.category("yourCategory")
    			.tenantId("dfdfe32fsdfsdfsf")
    			.addClasspathResource("workflow/reimbursement/reimbursement.bpmn").deploy();

        System.out.println("部署ID:"+dep.getId());//1  
        System.out.println("部署时间:"+dep.getDeploymentTime());  
        
        return "redirect:list";
    }  
    
    /**
     * 输入流部署
     * @return
     */
    @RequestMapping(value = "/depinputstream")
    public String deployementProDefByInS() throws FileNotFoundException{  
        //获取资源相对路径  
        String bpmnPath = "D:/reimbursement.bpmn";
          
        //读取资源作为一个输入流  
        FileInputStream bpmnfileInputStream = new FileInputStream(bpmnPath);  
          
        Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                        .name("reimbursement") 
                        .addInputStream("reimbursement.bpmn",bpmnfileInputStream)  
                        .deploy();//完成部署  
        System.out.println("部署ID:"+deployment.getId());//1  
        System.out.println("部署时间:"+deployment.getDeploymentTime());  
        
        return "redirect:list";
    }  
    /**
     * 压缩包部署
     * @return
     */
    @RequestMapping(value = "/depzip")
    public String deployementProDefByZIP() throws FileNotFoundException{  
        //获取资源相对路径  
        String zipPath = "d:/reimbursement.zip";
        File f = new File(zipPath);   
        InputStream in = new FileInputStream(f);
        
        InputStream ins = this.getClass().getClassLoader().getResourceAsStream("diagrams/helloworld.zip");  
        
        //读取资源作为一个输入流  
        ZipInputStream zipfileInputStream = new ZipInputStream(in);  
          
        Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                        .name("reimbursement") 
                        .addZipInputStream(zipfileInputStream)
                        .deploy();//完成部署  
        System.out.println("部署ID:"+deployment.getId());//1  
        System.out.println("部署时间:"+deployment.getDeploymentTime());  
        
        return "redirect:list";
    }  
    
    /**
     * 字符串部署
     * @return
     */
    @RequestMapping(value = "/depstring")
    public String deployementProDefByStr() throws FileNotFoundException{  
        
    	String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><definitions>...</definitions>";  
        
        Deployment deployment = repositoryService.createDeployment()//获取流程定义和部署对象相关的Service  
                        .name("reimbursement") 
                        .addString("reimbursement.bpmn", str)
                        .deploy();//完成部署  
        System.out.println("部署ID:"+deployment.getId());//1  
        System.out.println("部署时间:"+deployment.getDeploymentTime());  
        
        return "redirect:list";
    }  
    
}

对应jsp文件如下
left.jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Zioer 流程开发学习</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url(../images/left.gif);
}
-->
</style>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<SCRIPT language=JavaScript>
function tupian(idt){
    var nametu="xiaotu"+idt;
    var tp = document.getElementById(nametu);
    tp.src="../images/ico05.gif";//图片ico04为白色的正方形
	
	for(var i=1;i<30;i++)
	{
	  
	  var nametu2="xiaotu"+i;
	  if(i!=idt*1)
	  {
	    var tp2=document.getElementById('xiaotu'+i);
		if(tp2!=undefined)
	    {tp2.src="../images/ico06.gif";}//图片ico06为蓝色的正方形
	  }
	}
}

function list(idstr){
	var name1="subtree"+idstr;
	var name2="img"+idstr;
	var objectobj=document.all(name1);
	var imgobj=document.all(name2);
	
	
	//alert(imgobj);
	
	if(objectobj.style.display=="none"){
		for(i=1;i<10;i++){
			var name3="img"+i;
			var name="subtree"+i;
			var o=document.all(name);
			if(o!=undefined){
				o.style.display="none";
				var image=document.all(name3);
				//alert(image);
				image.src="../images/ico04.gif";
			}
		}
		objectobj.style.display="";
		imgobj.src="../images/ico03.gif";
	}
	else{
		objectobj.style.display="none";
		imgobj.src="../images/ico04.gif";
	}
}

</SCRIPT>

<body>
<table width="198" border="0" cellpadding="0" cellspacing="0" class="left-table01">
  <tr>
    <TD>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		  <tr>
			<td width="207" height="55" background="../images/nav01.gif">
				<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
				  <tr>
					<td width="25%" rowspan="2"><img src="../images/ico00.gif" width="35" height="35" /></td>
					<td width="75%" height="22" class="left-font01">您好,<span class="left-font02">${userId}</span></td>
				  </tr>
				  <tr>
					<td height="22" class="left-font01">
						[&nbsp;<a href="../login/out" target="_top" class="left-font01">退出</a>&nbsp;]</td>
				  </tr>
				</table>
			</td>
		  </tr>
		</table>
		
		<!--  流程管理开始    -->
		<TABLE width="100%" border="0" cellpadding="0" cellspacing="0" class="left-table03">
          <tr>
            <td height="29">
				<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td width="8%"><img name="img8" id="img8" src="../images/ico04.gif" width="8" height="11" /></td>
						<td width="92%">
								<a href="javascript:" target="mainFrame" class="left-font03" onClick="list('8');" >流程管理</a></td>
					</tr>
				</table>
			</td>
          </tr>		  
        </TABLE>
		<table id="subtree8" style="DISPLAY: none" width="80%" border="0" align="center" cellpadding="0" 
				cellspacing="0" class="left-table02">
				<tr>
				  <td width="9%" height="20" ><img id="xiaotu20" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%"><a href="../process/add" target="mainFrame" class="left-font03" onClick="tupian('20');">新增流程</a></td>
				</tr>
				<tr>
				  <td width="9%" height="21" ><img id="xiaotu21" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%"><a href="../process/list" target="mainFrame" class="left-font03" onClick="tupian('21');">流程列表</a></td>
				</tr>
      </table>
		<!--  流程管理结束    -->
		
		<!--  用户管理开始    -->
		<TABLE width="100%" border="0" cellpadding="0" cellspacing="0" class="left-table03">
          <tr>
            <td height="29">
				<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td width="8%"><img name="img7" id="img7" src="../images/ico04.gif" width="8" height="11" /></td>
						<td width="92%">
								<a href="javascript:" target="mainFrame" class="left-font03" onClick="list('7');" >用户管理</a></td>
					</tr>
				</table>
			</td>
          </tr>		  
        </TABLE>
		<table id="subtree7" style="DISPLAY: none" width="80%" border="0" align="center" cellpadding="0" 
				cellspacing="0" class="left-table02">
				<tr>
				  <td width="9%" height="20" ><img id="xiaotu17" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%">
						<a href="../user/add" target="mainFrame" class="left-font03" onClick="tupian('17');">新增用户</a></td>
				</tr>
				<tr>
				  <td width="9%" height="20" ><img id="xiaotu18" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%">
					<a href="../user/list" target="mainFrame" class="left-font03" onClick="tupian('18');">用户列表</a></td>
				</tr>
				<tr>
				  <td width="9%" height="20" ><img id="xiaotu19" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%">
						<a href="../group/add" target="mainFrame" class="left-font03" onClick="tupian('19');">新增组
							</a></td>
				</tr>
				<tr>
				  <td width="9%" height="20" ><img id="xiaotu24" src="../images/ico06.gif" width="8" height="12" /></td>
				  <td width="91%">
						<a href="../group/list" target="mainFrame" class="left-font03" onClick="tupian('24');">组列表
							</a></td>
				</tr>
      </table>
		<!--  用户管理结束    -->


	  </TD>
  </tr>
  
</table>
</body>
</html>

main.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
<head>
<title>Zioer流程开发学习</title>
</head>

<frameset rows="59,*" cols="*" frameborder="no" border="0" framespacing="0">
  <frame src="top" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
  <frameset cols="213,*" frameborder="no" border="0" framespacing="0">
    <frame src="left" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
    <frame src="main" name="mainFrame" id="mainFrame" title="mainFrame" />
  </frameset>
</frameset>
<noframes><body>
</body>
</noframes></html>

mainfra.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 1px;
	margin-right: 0px;
	margin-bottom: 0px;
}
html { overflow-x: ; overflow-y: ; border:0;} 
-->
</style>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#4AA3D8"></td>
  </tr>
  <tr>
    <td><table width="768" height="500" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><img src="../images/welcome.gif" width="768" height="536" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

top.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
<head>
<title>Zioer流程开发学习</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="59" background="../images/top.gif"><table width="99%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1%"><a href="http://www.zioer.com/" target="_blank"><img src="../images/logo.gif" width="557" height="59" border="0" /></a></td>
        <td width="64%" align="right" style="font-size:12px;vertical-align:bottom;">&copy; 2016-2017 <a href="http://www.zioer.com/" style="color:#0099FF;text-decoration:none;">www.zioer.com</a> QQ:123339443 Email:123339443@qq.com</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

启动项目,访问地址http://localhost:8080/process/list
结果如下所示
在这里插入图片描述
点击右侧相关按钮可以查看xml/png和删除流程
在这里插入图片描述
比如点击xml查看
在这里插入图片描述
点击IMAGE查看
在这里插入图片描述
存在乱码
由于ProcessEngineConfiguration默认的编码为Arial,所以出现了乱码
在这里插入图片描述
修改使用的字体为中文类型

package com.xquant.platform.test.activiti.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author: guanglai.zhou
 * @date: 2021/3/26 17:41
 * @description: TODO
 * @version: 1.0
 */
@Component
public class MyBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {

    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition springProcessEngineConfiguration = beanFactory.getBeanDefinition("springProcessEngineConfiguration");
        //   protected String activityFontName = "Arial";
        //  protected String labelFontName = "Arial";
        springProcessEngineConfiguration.getPropertyValues().add("activityFontName", "宋体");
        springProcessEngineConfiguration.getPropertyValues().add("labelFontName", "宋体");
    }
}

再次部署可以看到结果是为中文了
在这里插入图片描述
另外访问http://localhost:8080/process/add地址也可以添加流程定义
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Spring Boot 集成 Activiti 7 流程定义非常简单,可以通过以下步骤来实现: 1. 引入 Activiti 的依赖,在 pom.xml 文件中添加如下内容: ```xml <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic</artifactId> <version>7.0.0.M4</version> </dependency> ``` 2. 创建流程定义文件,例如 bpmn 文件,并将其放置在 classpath 目录下。 3. 在 Spring Boot 应用中配置 Activiti 相关的 bean,如下所示: ```java @Configuration public class ActivitiConfig { @Bean public SpringProcessEngineConfiguration processEngineConfiguration(DataSource dataSource, PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) { SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration(); config.setDataSource(dataSource); config.setTransactionManager(transactionManager); config.setAsyncExecutor(springAsyncExecutor); config.setDeploymentResources(new Resource[]{new ClassPathResource("processes/myProcess.bpmn20.xml")}); config.setDbIdentityUsed(false); return config; } @Bean public ProcessEngine processEngine(SpringProcessEngineConfiguration processEngineConfiguration) { return processEngineConfiguration.buildProcessEngine(); } @Bean public RepositoryService repositoryService(ProcessEngine processEngine) { return processEngine.getRepositoryService(); } @Bean public RuntimeService runtimeService(ProcessEngine processEngine) { return processEngine.getRuntimeService(); } @Bean public TaskService taskService(ProcessEngine processEngine) { return processEngine.getTaskService(); } } ``` 4. 在代码中通过 Activiti 的 API 启动流程,如下所示: ```java runtimeService.startProcessInstanceByKey("myProcess"); ``` 在运行过程中,可以使用 Activiti 的 API 查询和操作流程,例如查询任务列表、完成任务等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lang20150928

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值