Spring引导-将/health端点的位置更改为/ping/me

Spring引导-将/health端点的位置更改为/ping/me,spring,spring-boot,spring-boot-actuator,health-monitoring,Spring,Spring Boot,Spring Boot Actuator,Health Monitoring,我将endpoints.health.path属性设置为/ping/me。但我无法使用访问端点 它只适用于。我错过了什么? 以下是应用程序属性文件中的代码 #Configuration for Health endpoint endpoints.health.id=health endpoints.health.path=/ping/me endpoints.health.enabled=true endpoints.health.sensitive=false #Manage endpoin

我将
endpoints.health.path
属性设置为
/ping/me
。但我无法使用访问端点 它只适用于。我错过了什么? 以下是应用程序属性文件中的代码

#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
我得到的答复是:

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

有关弹簧靴2,请参见下文。*


MvcEndpoints
负责读取
端点。{name}.path
配置以及在其
AfterPropertieSet
方法中:

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);
            }
}
for(端点:委托){
if(isGenericeEndpoint(endpoint.getClass())&&endpoint.isEnabled()){
EndpointMvcAdapter适配器=新的EndpointMvcAdapter(端点);
字符串路径=this.applicationContext.getEnvironment()
.getProperty(“endpoints.+endpoint.getId()+”.path”);
if(路径!=null){
adapter.setPath(路径);
}
this.endpoints.add(适配器);
}
}
它拒绝设置
endpoints.health.path
,因为
isGenericEndpoint(…)
正在为
HealthEndpoint
返回
false
。也许是虫子什么的


更新:显然这是一个bug,已在版本中修复。因此,在此版本中,您可以使用
/ping/me
作为运行状况监视路径

执行器在Spring Boot 2.0.0中变得与技术无关,因此它现在与MVC无关。因此,如果使用Spring Boot 2.0.x,只需添加以下配置属性:

# 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
如果您不重写
管理.endpoints.web.base路径
,您的健康检查将在
/exactor/ping/me
上提供


endpoints.*
这样的属性在Spring Boot 2.0.0中被弃用。

它没有帮助。应用程序抛出绑定错误。是否使用
/ping/me
?它仍然是一个
id
,您不能使用
id
中的
/
将id设置为“ping”,并将路径设置为“ping”。但我不能指定像“ping me”这样的连字符。我是根据spring boot文档中的文档进行尝试的:“例如,要将/health端点的位置更改为/ping/me,您可以设置endpoints.health.path=/ping/me”@Nagendra Kakarla您可以在
1.3.3.RELEASE
version中使用此功能。帮助我更改实际的执行器健康检查url。谢谢