사실 건강 상태 종점은 하나 이상의 지표를 확인합니다. 기본적으로 봄 부팅 응용 프로그램이 안전하기 때문에 {"status":"DOWN"}
만 있습니다.
endpoints.health.sensitive=false
모든 건강 지표를 표시하도록 application.properties
와
당신은 수정할 수 있습니다.
이 페이지에있는 모든 자동 구성의 건강 지표를 찾을 수 있습니다
: http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#_auto_configured_healthindicators
을 또한, 당신은 HealthIndicator
를 구현하여 자신의 상태 표시기를 작성할 수 있습니다.
@Component
public class MyHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
}
괜찮 으면 좋겠지 만 내 HealthIndicator 정보를/health 엔드 포인트에 추가하려면 어떻게해야합니까? –
명시 적으로 추가 할 필요가 없습니다. Spring은 인디케이터를 스캔하여 자동으로 추가합니다. –
그래, 내 혼란 스러움 부분이라고 생각해. 내 사용자 지정 표시기가 호출되었음을 알지만,/health 끝 점이 여전히 {{ "상태": "DOWN"} '이라고 말합니다. "상태"가 아닌 내 표시기에 대한 자세한 정보가 필요합니다. –