Spring Boot - Change the location of the /health endpoint to /ping/me

Nagendra Kakarla picture Nagendra Kakarla · Feb 17, 2016 · Viewed 15.5k times · Source

I set the endpoints.health.path property to /ping/me. But I cannot access the endpoint using http://localhost:9000/ping/me It only works with http://localhost:9000/health. What am I missing ? Here is the code in app properties file.

#Configuration for Health endpoint
endpoints.health.id=health
endpoints.health.path=/ping/me
endpoints.health.enabled=true
endpoints.health.sensitive=false

#Manage endpoints
management.port=9000
management.health.diskspace.enabled=false

The response I get is :

{
"timestamp" : 1455736069839,
"status" : 404,
"error" : "Not Found",
"message" : "Not Found",
"path" : "/ping/me"
}

Answer

Vladimir Vagaytsev picture Vladimir Vagaytsev · May 16, 2018

The Actuator became technology-agnostic in Spring Boot 2.0.0, so it's not tied to MVC now. Thus if you use Spring Boot 2.0.x, you can just add the following config properties:

# custom actuator base path: use root mapping `/` instead of default `/actuator/`
management.endpoints.web.base-path=

# override endpoint name for health check: `/health` => `/ping/me`
management.endpoints.web.path-mapping.health=/ping/me

If you don't override the management.endpoints.web.base-path, your health-check will be available at /actuator/ping/me.

The properties like endpoints.* became deprecated in Spring Boot 2.0.0.