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

SpringBoot响应式应用中AppMap recorder启动失败:API端点不存在

解决Spring Boot 2.7.12响应式栈AppMap录制404问题

核心原因

Spring Boot响应式栈(WebFlux)与Servlet栈的请求处理机制差异较大,AppMap默认的端点注册逻辑未完全覆盖WebFlux场景——即使官方文档说明无需Maven构建配置,也需要针对响应式环境做额外适配。

具体解决步骤

  • 更新AppMap插件:确保IntelliJ的AppMap插件是最新版本,旧版本对WebFlux的支持存在兼容性问题。
  • 手动注册WebFlux路由:创建配置类,显式将/_appmap/**路径映射到AppMap的WebFlux处理器,示例代码如下:
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;
import com.appland.appmap.web.WebFluxHandler;

@Configuration
public class AppMapWebFluxConfig {
    @Bean
    public RouterFunction<ServerResponse> appMapRouter(WebFluxHandler webFluxHandler) {
        return RouterFunctions.route()
                .path("/_appmap", builder -> builder
                        .nest().path("/**", nested -> nested
                                .GET("", webFluxHandler::handle)
                                .POST("/record", webFluxHandler::handle)
                                .PUT("/record", webFluxHandler::handle)
                                .DELETE("/record", webFluxHandler::handle)
                                .GET("/**", webFluxHandler::handle))
                        .build())
                .build();
    }
}
  • 验证运行时依赖:检查项目External Libraries中是否存在appmap-agent相关依赖。若缺失,手动在pom.xml中添加(响应式场景可能需要显式引入):
<dependency>
    <groupId>com.appland</groupId>
    <artifactId>appmap-agent</artifactId>
    <version>latest</version>
    <scope>runtime</scope>
</dependency>
  • 排查自动配置禁用情况:确认项目@SpringBootApplication注解未排除AppMap的自动配置类(如AppMapAutoConfiguration、AppMapWebFluxAutoConfiguration)。
  • 调试路由注册:启动应用时添加JVM参数-Dlogging.level.org.springframework.web.reactive=DEBUG,查看WebFlux路由注册日志,确认/_appmap/record端点是否被正确加载。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.19 09:07:51