You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置spring.mvc.servlet.path后Camunda WebApp在Spring Boot中无法访问

Spring Boot集成Camunda仪表盘路径问题解决方案

当你设置了spring.mvc.servlet.path=/my-app/v1后,Camunda的默认web应用路径不会自动继承这个前缀,导致无法访问仪表盘,可通过以下几种方式解决:

  • 配置Camunda应用路径前缀
    在application.properties或application.yml中添加Camunda web应用的路径配置,让它和你的Spring MVC路径对齐:

    • properties格式:
      camunda.bpm.webapp.application-path=/my-app/v1/camunda
      
    • yml格式:
      camunda:
        bpm:
          webapp:
            application-path: /my-app/v1/camunda
      

    配置完成后,就可以通过/my-app/v1/camunda/app/cockpit、/my-app/v1/camunda/app/tasklist等路径访问对应的仪表盘了。

  • 确认Camunda Webapp依赖已引入
    确保你的构建文件中包含了Camunda Spring Boot Webapp Starter依赖,没有这个依赖的话,Camunda仪表盘不会被部署:

    • Maven(pom.xml):
      <dependency>
        <groupId>org.camunda.bpm.springboot</groupId>
        <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
        <version>你的Camunda版本号</version>
      </dependency>
      
    • Gradle(build.gradle):
      implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:你的Camunda版本号'
      
  • 排除Camunda路径的拦截规则
    如果项目中有自定义的拦截器或过滤器,可能会拦截Camunda的请求。可以添加一个WebMvc配置类,确保Camunda的静态资源能被正确映射:

    import org.springframework.context.annotation.Configuration;
    import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
    import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
    
    @Configuration
    public class CamundaWebConfig implements WebMvcConfigurer {
        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
            registry.addResourceHandler("/my-app/v1/camunda/**")
                    .addResourceLocations("classpath:/META-INF/resources/webjars/camunda/");
        }
    }
    
  • 检查启动日志验证Servlet注册
    启动应用后,查看控制台日志,确认是否有类似Mapping servlet: 'Camunda BPM webapp' to [/my-app/v1/camunda/*]的记录。如果没有这条日志,说明Camunda的webapp Servlet未被正确注册,需要检查依赖或配置是否有误。

内容的提问来源于stack exchange,提问作者Sha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 17:30:04