我可以从 Spring Boot 2 执行器集成中删除执行器字以进行健康检查吗

Arp*_*Das 3 yaml health-monitoring spring-boot spring-boot-actuator

我在我的微服务中使用了 spring-boot-acturator 进行健康检查。早些时候我的健康 API 是:

mydomain:healthPort/health
Run Code Online (Sandbox Code Playgroud)

其中已经与第三方健康检查客户端集成。现在将 spring-boot 版本升级到 spring-boot 2 后,我的健康 api 变为:

mydomain:healthPort/actuator/health
Run Code Online (Sandbox Code Playgroud)

有什么办法,因此我可以从健康检查api中删除执行器词。以下是我的健康检查配置:

management:
  server:
    context-path: /
    port: 50186
  health.diskspace.enabled: false
  security:
    enabled: false
  endpoints:
    enabled-by-default: false
  endpoint:
    health:
      enabled: true
      show-details: always
Run Code Online (Sandbox Code Playgroud)

Arp*_*Das 5

经过一番搜索,我得到了解决方案。在这里发帖,因为它可能会为其他人节省一些时间:

management:
    endpoints:
        enabled-by-default: false
        web:
            base-path: /
            path-mapping.health: health
    endpoint:
        health.enabled: true
        health.show-details: always
    server.port: 50186
Run Code Online (Sandbox Code Playgroud)

这样映射就解决了,主要是下面的部分重映射url:

管理:端点:

        web:
            base-path: /
            path-mapping.health: health
Run Code Online (Sandbox Code Playgroud)


Nat*_*yer 4

为了完整起见......基于阿尔潘的答案,以下是这样application.properties做的方法:

management.endpoints.web.base-path=/
Run Code Online (Sandbox Code Playgroud)

以及application.yml方式:

management:
  endpoints:
    web:
      base-path: /
Run Code Online (Sandbox Code Playgroud)