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

如何在现有Spring Boot项目中添加Camunda BPMN并访问其面板?

在现有Spring Boot MVC应用中集成Camunda BPMN及访问控制面板

当然可以在你现有的Spring Boot MVC应用中集成Camunda BPMN,Camunda提供了官方的Spring Boot Starter,能无缝和现有MVC组件兼容,下面是具体步骤:

1. 添加Camunda依赖

在项目构建文件中添加Camunda Spring Boot Starter依赖,推荐包含webapp starter,这样会自动引入控制面板:

Maven 示例

<dependency>
    <groupId>org.camunda.bpm.springboot</groupId>
    <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    <version>7.21.0</version> <!-- 使用最新稳定版本 -->
</dependency>
<!-- 按需添加数据库驱动依赖,如H2/MySQL等 -->

Gradle 示例

implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:7.21.0'

2. 调整Camunda上下文路径(关键)

你的应用已将localhost:8080/设为首页,而Camunda webapp默认上下文路径也是/,会导致冲突。需在application.properties或application.yml中修改Camunda的路径:

application.properties

# 指定Camunda控制面板的访问路径
camunda.bpm.webapp.context-path=/camunda

application.yml

camunda:
  bpm:
    webapp:
      context-path: /camunda

3. 配置数据库(必要)

Camunda需要存储流程实例、任务等数据,默认使用内嵌H2数据库(仅适合开发环境)。若使用生产级数据库(如MySQL、PostgreSQL),需添加对应驱动并配置连接信息:

# MySQL配置示例
spring.datasource.url=jdbc:mysql://localhost:3306/camunda_db?useSSL=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=your_db_password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# 自动更新Camunda数据库表结构(开发环境可用,生产建议手动执行脚本)
camunda.bpm.database.schema-update=true

4. 访问Camunda控制面板

启动Spring Boot应用后,在浏览器中访问:localhost:8080/camunda

默认登录凭据:

  • 用户名:demo
  • 密码:demo

如果你的应用集成了Spring Security,需额外配置放行Camunda相关路径,示例:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .antMatchers("/camunda/**").permitAll() // 或按需配置权限校验规则
            .anyRequest().authenticated();
    }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 23:22:22