在Camunda7 Spring boot中分配所需的文件夹来读取和部署BPMN文件

问题描述 投票:0回答:1

Camunda7引擎默认通过文件夹读取NPMN文件: 读取

src/main/resources
并部署在 Spring boot 项目中。现在,如果在有很多包和模块的大型项目中,而Camunda只是其中之一,我们打算为此考虑一个所需的文件夹,并将其地址引入Camunda引擎,这是如何通过Java代码编写的?

@Bean
  CommandLineRunner run(RepositoryService repositoryService){
    return args -> {

          repositoryService.createDeployment()
            .addClasspathResource("src/main/java/com/example/workflow/processes/*.bpmn")
            .deploy();


    };

  }

在上面的代码中,遇到错误,提示找不到源!

Caused by: org.camunda.bpm.engine.exception.NullValueException: resource 'src/main/java/com/example/workflow/processes/*.bpmn' not found: inputStream is null

我在这个字符串中应用了几乎所有类型的寻址,但我猜想也许我的解决方案是错误的。 我们如何使用 Java 代码应用这些设置?

spring-boot camunda bpmn business-process-management
1个回答
0
投票

addClasspathResource 方法需要部署一个具体资源,因此不允许使用通配符。 您可以自己扫描类路径,然后添加所有找到的资源。 Spring为此提供了ResourcePatternResolver。 https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/support/ResourcePatternResolver.html

© www.soinside.com 2019 - 2024. All rights reserved.