Spring Download - change the location of the / health endpoint in / ping / me

I set the property endpoints.health.pathto /ping/me. But I can’t 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 the application 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

I get the answer:

{
"timestamp" : 1455736069839,
"status" : 404,
"error" : "Not Found",
"message" : "Not Found",
"path" : "/ping/me"
}
+4
source share
1 answer

MvcEndpointsresponsible for reading configurations endpoints.{name}.pathand somehow according to the method afterPropertiesSet:

for (Endpoint<?> endpoint : delegates) {
            if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) {
                EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint);
                String path = this.applicationContext.getEnvironment()
                        .getProperty("endpoints." + endpoint.getId() + ".path");
                if (path != null) {
                    adapter.setPath(path);
                }
                this.endpoints.add(adapter);
            }
}

Failure to install endpoints.health.path, as it isGenericEndpoint(...)returns falsefor HealthEndpoint. Maybe this is a mistake or something like that.

: -, ​​ 1.3.3.RELEASE. , /ping/me .

+3

Source: https://habr.com/ru/post/1629241/


All Articles