복붙노트

[SPRING] 봄 부팅 건강이 세부 정보를 표시하지 않음 (withDetail info)

SPRING

봄 부팅 건강이 세부 정보를 표시하지 않음 (withDetail info)

HealthIndicator를 구현하는 클래스를 작성하여 health-method를 재정의했습니다. 나는 Health.down ()을 반환합니다. withDetail ( "SupportServiceStatus", "UP"). build ();

이것은 나의 건강 종말점을 돌려 보내야한다 :

{
    "status":"UP",
    "applicationHealth": {
        "status":"UP"
    }
}

대신 그냥 반환 (세부 정보없이 건강) :

{
    "status":"UP",
}

Java 코드 (다소 단순화 됨) :

@Component
public class ApplicationHealth implements HealthIndicator {

  @Override
  public Health health() {
    return check();
  }

  private Health check() {
    return Health.up().withDetail("SupportServiceStatus", supportServiceStatusCode).build();
  }

}

해결법

  1. ==============================

    1.스프링 부트 문서에 따르면 :

    스프링 부트 문서에 따르면 :

    해결책은 application.properties에서 endpoints.health.sensitive를 false로 설정하는 것입니다.

    application.properties

    endpoints.health.sensitive=false
    

    > 1.5.1 application.properties의 경우

    management.security.enabled=false 
    

    스프링 부트 2.0.0.RELEASE (thx rvit34) :

    management:
       endpoint:
          health:
            show-details: "ALWAYS"
    
  2. ==============================

    2.'endpoints.health.sensitive'를 설정해도 아무런 차이가 없어 ... 설정해야했습니다.

    'endpoints.health.sensitive'를 설정해도 아무런 차이가 없어 ... 설정해야했습니다.

    management:
        security:
            enabled: false
    
  3. ==============================

    3.Spring Boot 2.0.0에서. 릴리즈 :

    Spring Boot 2.0.0에서. 릴리즈 :

    management:
       endpoint:
          health:
            show-details: "ALWAYS"
    
  4. ==============================

    4.@ rvit34와 @ Ninja Code Monkey에게 감사드립니다.

    @ rvit34와 @ Ninja Code Monkey에게 감사드립니다.

    Spring Boot 2.x.x.RELEASE의 경우,

    application.properties에 대해 아래에서 사용하십시오.

    management.endpoint.health.show-details = 항상

    application.yml에 대해 아래에서 사용하십시오.

    조치:   종점 :     건강:       show-details : "항상"

  5. ==============================

    5.나는 Spring boot 1.5.9에서 같은 문제를 겪었다. 나는 설정해야했다.

    나는 Spring boot 1.5.9에서 같은 문제를 겪었다. 나는 설정해야했다.

    management.security.enabled=false
    
  6. from https://stackoverflow.com/questions/32971182/spring-boot-health-not-showing-details-withdetail-info by cc-by-sa and MIT license