Spring Boot - /health 끝점의 위치를 /ping/me로 변경합니다.
설정합니다.endpoints.health.path
에 대한 재산./ping/me
그러나 http://localhost:9000/ping/me를 사용하여 끝점에 액세스할 수 없음 http://localhost:9000/health에서만 작동합니다.제가 무엇을 빠뜨리고 있나요?앱 속성 파일의 코드입니다.
#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"
}
액추에이터는 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
만약 당신이 그것을 무시하지 않는다면.management.endpoints.web.base-path
당신의 건강 검진은 다음 장소에서 가능할 것입니다./actuator/ping/me
.
속성은 다음과 같습니다.endpoints.*
Spring Boot 2.0.0에서 더 이상 사용되지 않습니다.
Spring Boot 2는 아래를 참조하십시오.* https://stackoverflow.com/a/50364513/2193477
MvcEndpoints
읽기를 담당합니다.endpoints.{name}.path
구성 및 그 안에서.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);
}
}
설정을 거부합니다.endpoints.health.path
,부터isGenericEndpoint(...)
돌아오는 중false
위해서HealthEndpoint
아마도 벌레나 뭐 그런 것 같습니다.
업데이트: 분명히 이것은 버그였고 버전에서 수정되었습니다.사용할 수 있습니다./ping/me
이 버전에서는 상태 모니터링 경로로 사용할 수 있습니다.
언급URL : https://stackoverflow.com/questions/35465556/spring-boot-change-the-location-of-the-health-endpoint-to-ping-me
'sourcecode' 카테고리의 다른 글
스프링 부팅 및 최대 절전 모드: DDL 인쇄/로그 (0) | 2023.07.07 |
---|---|
XPath 네임스페이스가 있는 노드 선택 (0) | 2023.07.07 |
GeoFire를 Firestore와 함께 사용할 수 있는 방법이 있습니까? (0) | 2023.07.07 |
연결을 허용하기 위해 봄 부팅에서 Tcp 연결을 만드는 방법은 무엇입니까? (0) | 2023.07.07 |
SQL Server Management Studio에서 마우스 오른쪽 버튼으로 스크립트 변경 테이블 사용 안 함 (0) | 2023.07.07 |