스프링 부트 상태가 세부 정보를 표시하지 않음(withDetail info)
HealthIndicator를 구현하는 클래스를 작성했습니다.헬스 메서드를 덮어씁니다.나는 돌아간다Health.down().withDetail("SupportServiceStatus", "UP").build();
이거면 내 거랑...health- 반환:
{
"status":"UP",
"applicationHealth": {
"status":"UP"
}
}
대신 (상태, 세부사항 없음)만 반환됩니다.
{
"status":"UP",
}
Javacode(일부 간략화):
@Component
public class ApplicationHealth implements HealthIndicator {
@Override
public Health health() {
return check();
}
private Health check() {
return Health.up().withDetail("SupportServiceStatus", supportServiceStatusCode).build();
}
}
스프링 부트 문서에 따르면:
디폴트로는 헬스상태만 인증되지 않은HTTP 접속을 통해 공개됩니다.완전한 건강 정보가 항상 노출되는 데 만족하는 경우 다음을 설정할 수 있습니다.
endpoints.health.sensitive로.false.
해결 방법은 다음과 같습니다.endpoints.health.sensitive로.false에application.properties.
application.properties
endpoints.health.sensitive=false
1.5.1 이상의 application.properties의 경우
management.security.enabled=false
Spring Boot 2.0.0으로.릴리스(thx)@rvit34그리고.@nisarg-panchal):
management:
endpoint:
health:
show-details: "ALWAYS"
endpoints:
web:
exposure:
include: "*"
management.endpoints.web.exposure.include=*필요한 경우 모든 엔드포인트를 표시합니다.
최신 매뉴얼은 다음 URL에서 찾을 수 있습니다.https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
Spring Boot 2.0.0으로.릴리즈:
management:
endpoint:
health:
show-details: "ALWAYS"
@rvit34와 @Ninja Code Monkey에 감사드립니다.
Springboot 2.x.x의 경우풀어주다,
application.properties는 다음과 같습니다.
management.endpoint.health.show-details=ALWAYS
applicationaton.yml에는 아래를 사용합니다.
management: endpoint: health: show-details: "ALWAYS"
'엔드포인트 설정 중.health.sensitive'는 아무런 차이가 없었다...설정할 필요가 있다:
management:
security:
enabled: false
추가할 필요가 있다
management.endpoint.health.show-details=always
Application.properties로 이동합니다.
스프링 부트 2.X의 경우 자세한 내용은 application.properties 파일에 다음과 같이 기재되어 있습니다.
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=ALWAYS
같은 문제가 있었습니다.스프링 부트 1.5.9 버전에서는
management.security.enabled=false
언급URL : https://stackoverflow.com/questions/32971182/spring-boot-health-not-showing-details-withdetail-info
'programing' 카테고리의 다른 글
| 입력 숨김 필드에 반환 json 값 저장 (0) | 2023.03.06 |
|---|---|
| Toad 대체 방법 (0) | 2023.03.06 |
| 순환 참조가 있는 경우에도 DOM 노드를 JSON으로 시리얼화하려면 어떻게 해야 합니까? (0) | 2023.03.06 |
| 스프링 부트 - Environment @Autowired가 Null Pointer를 슬로우합니다.예외. (0) | 2023.03.06 |
| Spring JPA Repository - jsonObject의 연산자 SIMPLE_PROPERTY에는 스칼라 인수가 필요합니다. (0) | 2023.03.06 |