如何在 springboot 从 1.5.x 升级到 2.3.x 后保留旧的执行器端点

How to retain old actuator endpoint after springboot upgrade from 1.5.x to 2.3.x

我正在尝试将 springboot 应用程序从 1.5.x 迁移到 2.3.x。已经走了很长一段路。我知道现在用于健康检查的端点是 /actuator/health 而不是旧版本中的 /health。

在 openshift 上,配置在进行就绪探测时仍然引用 /health 端点。我想知道如何仍然使用 /health 端点而不是 /actuator/health。 springboot 2是否有任何钩子来覆盖默认端点。感谢任何帮助。

您可以像这样更改执行器的路径:

management.endpoints.web.base-path=/

那么你还有 /health 而不是 /actuator/health

但要注意路径名称不要冲突。