Apache Camel Spring Boot健康检查详情不显示问题求助
问题描述
使用Apache Camel Spring Boot 3.1.2(Camel版本4.0.0),已启用健康检查且功能正常,但/health接口始终仅返回UP/DOWN状态,无详细信息,即便已将exposure-level设置为full。当前配置如下:
management: endpoints: web: base-path: "/" exposure: include: health,info,loggers,camelroutes probes: enabled: true health: show-details: always health: livenessState: enabled: true readinessState: enabled: true camel: springboot: route-controller-supervise-enabled: true route-controller-back-off-max-attempts: 10 health: enabled: true # level of details exposed by camel-health check (full, default, or oneline) exposure-level: full producers-enabled: true registry-enabled: true consumers-enabled: true routes-enabled: true
预期设置exposure-level: full后应显示更多健康检查详情,但未生效。
解决方案
修正Spring Boot健康详情配置层级:你的配置中
management.endpoints.health.show-details路径有误,Spring Boot正确配置应为management.endpoint.health.show-details(单数endpoint),修改后配置:management: endpoint: health: show-details: always该配置控制Actuator健康端点是否展示详细信息,只有开启后,Camel的健康检查详情才会被聚合返回。
确认依赖完整性:确保项目已引入
camel-health-starter依赖(Maven示例):<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-health-starter</artifactId> <version>4.0.0</version> </dependency>缺失该依赖会导致Camel健康检查的详细项无法加载。
验证路由监控状态:通过
/camelroutes端点确认路由均处于started状态,确保camel.springboot.route-controller-supervise-enabled: true已生效,路由控制器未正常监控会导致路由相关健康详情缺失。访问细分健康端点:默认
/health返回聚合状态,可直接请求/health/liveness或/health/readiness端点,查看是否包含Camel的健康检查详情。
内容的提问来源于stack exchange,提问作者Harold Chen

