是否可以将 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/