gpt4 book ai didi

java - Activiti:没有使用 key 'oneVacationProcess' 部署进程

转载 作者:行者123 更新时间:2023-11-30 07:27:13 32 4
gpt4 key购买 nike

我想在spring mvc中使用activiti。我的 activiti java 配置如下。当我运行项目时,此异常没有使用 key 部署进程抛出。我将 one-vacation-process.bpmn20.xml 放在资源文件夹中。我的问题是什么?感谢您的帮助。

  @Configuration
public class ActivitiConfig {

@Bean
public ProcessEngine processEngine(ProcessEngineConfigurationImpl pec, ApplicationContext applicationContext) throws Exception {
ProcessEngineFactoryBean pe = new ProcessEngineFactoryBean();
pe.setProcessEngineConfiguration(pec);
pe.setApplicationContext(applicationContext);

return pe.getObject();
}

@Bean
public ProcessEngineConfigurationImpl getProcessEngineConfiguration(
DataSource dataSource,
PlatformTransactionManager transactionManager,
ApplicationContext context) {
SpringProcessEngineConfiguration pec = new SpringProcessEngineConfiguration();

pec.setDataSource(dataSource);
pec.setDatabaseSchemaUpdate("true");
pec.setJobExecutorActivate(true);
pec.setHistory("full");
pec.setMailServerPort(2025);
pec.setDatabaseType("mysql");

pec.setTransactionManager(transactionManager);
pec.setApplicationContext(context);

return pec;
}

@Bean
public RuntimeService getRuntimeService(ProcessEngine processEngine) {
return processEngine.getRuntimeService();
}
@Bean
public TaskService taskService(ProcessEngine processEngine) throws Exception {
return processEngine.getTaskService();
}

最佳答案

您需要先部署您的流程。

有针对不同用例的 API,这里我部署了一个流程,其中 resourceName 是流程 xml 的名称(例如 one-vacation-process.bpmn20.xml) content 实际文件内容作为字符串。

RepositoryService repositoryService = processEngine.getRepositoryService();
DeploymentBuilder builder = repositoryService.createDeployment().addString(resourceName, content);
builder.enableDuplicateFiltering().deploy();

看看 org.activiti.engine.repository.DeploymentBuilder ,其中有如下 API:

DeploymentBuilder addInputStream(String resourceName, InputStream inputStream);
DeploymentBuilder addClasspathResource(String resource);
DeploymentBuilder addString(String resourceName, String text);
DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream);
DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel);

关于java - Activiti:没有使用 key 'oneVacationProcess' 部署进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36661116/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com