java.lang.ClassNotFoundException:org.springframework.boot.actuate.health.HealthAggregator 将 spring-boot 版本从 2.3.12 RE 升级到 2.7.18

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

这是我无法加载应用程序的错误

Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/actuate/health/HealthAggregator`

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.health.HealthAggregator

这些是我要升级到的版本

从 spring-boot 2.3.12 RELEASE 升级到 2.7.18 和 spring-cloud Hoxton SR12 至 2021.0.8

这个问题应该采取什么解决方案?

spring-boot spring-boot-actuator versionupgrade
1个回答
0
投票

您遇到的错误是因为 Spring Boot 2.3.x 中存在的 HealthAggregator 类在 Spring Boot 2.7.x 中不再可用。在 Spring Boot 2.2.x 及更早版本中,HealthAggregator 用于将多个 Health 实例聚合为单个整体 Health 状态。从 Spring Boot 2.2 开始,该机制被 HealthContributor 和 HealthIndicator 接口取代,以提供更灵活的方式来贡献整体健康状态。

鉴于您要升级到 Spring Boot 2.7.x,您需要调整健康检查配置和自定义健康指标才能使用新的 API。

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