source

액추에이터에서 모든 엔드포인트를 활성화하는 방법(스프링 부트 2.0.0 RC1)

myloves 2023. 4. 3. 21:55

액추에이터에서 모든 엔드포인트를 활성화하는 방법(스프링 부트 2.0.0 RC1)

1.5.10에서 Spring Boot 2.0.0 RC1로 이행했는데 최신 버전에서 액튜에이터가 움직이지 않습니다.모든 액추에이터 엔드포인트 노출 및 활성화하려면 어떻게 해야 합니까?

노출되는 엔드포인트는 다음과 같습니다.

{
  "_links": {
    "self": {
      "href": "http://127.0.0.1:8080/actuator",
      "templated": false
    },
    "health": {
      "href": "http://127.0.0.1:8080/actuator/health",
      "templated": false
    },
    "info": {
      "href": "http://127.0.0.1:8080/actuator/info",
      "templated": false
    }
  }
}

이건 내 거야application.properties파일이야 뭐 생각나는 거 없어?

#The three first ones seem to be obsolete
endpoints.configprops.enabled=true
endpoints.beans.enabled=true
endpoints.shutdown.enabled=true

management.endpoints.enabled-by-default=true
management.endpoints.sensitive=false
management.endpoints.enabled=true

management.endpoint.configprops.enabled=true
management.endpoint.beans.enabled=true
management.endpoint.shutdown.enabled=true

management.endpoints.web.exposure.include=*

Spring Boot 2.0.0의 경우RC1, 액추에이터 엔드 포인트는 1) 활성화되고 2) 노출되어야 합니다.

디폴트로는 모든 엔드포인트를 제외하고shutdown유효하게 되어 있는 것은,health그리고.info노출되어 있습니다.

이 경우는, 다음의 조작이 가능합니다.

management.endpoints.web.expose=*
# if you'd like to expose shutdown:
# management.endpoint.shutdown.enabled=true

이것은 Spring Boot 2.0.0에서 (다시!) 변경되는 것에 주의해 주세요.RC2:

management.endpoints.web.exposure.include=*
# if you'd like to expose shutdown:
# management.endpoint.shutdown.enabled=true

확실히 전용 이행 가이드는 항상 최신 변경 사항을 반영하고 있습니다.

편집

복사 및 붙여넣기를 쉽게 하기 위해 Spring Boot 2.0.0 이후의 'yaml' 버전을 소개합니다.RC2:

management:
  endpoints:
    web:
      exposure:
        include: "*"

이전:

management:
  endpoints:
    web:
      expose: "*"

Spring Boot 2에서는 액튜에이터 보안이 변경되었습니다(1.X의 경우 액튜에이터 보안은 사용자 구성과 혼합될 때 문제가 발생하는 경우가 많습니다).스프링 부츠 2의 경우.X 액튜에이터에는 별도의 보안 설정이 없습니다.스프링 문서에 따르면:

보안을 위해 /health 및 /info 이외의 모든 액튜에이터는 기본적으로 비활성화되어 있습니다.management.endpoints.web.web 플래그를 사용하여 액추에이터를 활성화할 수 있습니다.Spring Security가 클래스 패스에 있고 다른 Web Security Configurer Adapter가 존재하지 않는 경우 액추에이터는 Spring Boot auto-config에 의해 보호됩니다.커스텀 Web Security Configurer Adapter를 정의하면 Spring Boot auto-config가 백오프되어 액튜에이터 액세스 규칙을 완전히 제어할 수 있게 됩니다.)

언급URL : https://stackoverflow.com/questions/48900892/how-to-enable-all-endpoints-in-actuator-spring-boot-2-0-0-rc1