java - 将 spring boot actuator 健康端点更改为自定义端点

标签 java spring-boot spring-boot-actuator

是否可以将 spring boot 执行器健康端点更改为自定义端点?像下面这样的东西。

http://localhost:8080/actuator/health

http://localhost:8080/myapp/apphealth

只想要更改名称而不是执行器/运行状况的响应。是否可以?

最佳答案

,这是可能的。

如何自定义执行器端点的路径在 this 中定义文档部分。

文档指出:

If you want to map endpoints to a different path, you can use the management.endpoints.web.path-mapping property.

The following example remaps /actuator/health to /healthcheck:

application.properties.

management.endpoints.web.base-path=/

management.endpoints.web.path-mapping.health=healthcheck

所以,在你的情况下你想要:

-- application.properties --
management.endpoints.web.base-path=/myapp
management.endpoints.web.path-mapping.health=apphealth

关于java - 将 spring boot actuator 健康端点更改为自定义端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52654763/

相关文章:

java - Android Studio DatePicker 在微调模式下显示年份部分

java - Spring Boot 应用程序执行器端点已注册且请求仍然失败

Spring Boot 2.0 Actuator git 属性未添加到/info

spring-boot-devtools 不会在多模块 maven 项目中重新加载依赖模块

java - 可以将自定义数据返回给 Kafka Producer

Spring Boot Actuator 'http.server.requests' 公制 MAX 时间

java - android:内部文件读取

java - 如何从不扩展 Activity 的类创建 TimePicker,Android?

java - 我可以将表名作为参数传递给 java 准备语句吗?

java - NotSerializableException for java.util.Optional with Jackson