Spring Boot 2健康执行器默认映射

Bon*_*cía 10 java spring spring-boot spring-boot-actuator

我正在使用Spring Boot 2 M3执行器.默认情况下,运行状况端点映射到/application/health.

  • 是否可以将此路径更改为/health

Sop*_*ice 13

在application.properties文件中添加此项以将基本路径设置为"/"

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

路径现在将是'/ health'

编辑:或者,如果您使用YAML:

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


Tay*_*ier 12

从Spring Boot 2.0.0开始的FYI.RELEASE是默认的健康端点 /actuator/health


Dar*_*the 5

请参阅Spring Boot 2.0.0的此文档,

https://docs.spring.io/spring-boot/docs/2.0.0.M4/reference/htmlsingle/#production-ready-customizing-management-server-context-path

该物业是,

management.context-path

我认为这应该有效,但现在无法验证. management.context-path=/

  • 这对于Spring Boot 1.x是正确的,但对于Spring Boot 2.x是不正确的.在这种情况下使用的属性是`management.endpoints.web.base-path` (15认同)