我想在春季MVC中使用Activiti。我的Activiti的Java配置如下。
当我运行项目时,此异常no processes deployed with 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:没有使用键“oneVacationProcess”部署的进程,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36661116/