springcloud 인터페이스 로 설정 재 부팅 및 읽 기

1. 설정 을 다시 시작 하거나 읽 으 려 면 actuator 와 관련 된 기능 이 필요 하기 때문에 가방 을 먼저 도입 하고 pom. xml 에 다음 설정 을 추가 해 야 합 니 다.
		
			org.springframework.boot
			spring-boot-starter-actuator
		

2. 시작 클래스 에서 사용자 가 설정 기능 을 자동 으로 새로 고침 합 니 다. 즉, 시작 클래스 에 @ RefreshScope 주 해 를 추가 합 니 다.
@RefreshScope
public class ServiceGatewayApplication

3. Yml 파일 을 설정 하고 관련 인터페이스 에 접근 할 수 있 습 니 다. 코드 는 다음 과 같 습 니 다.
management:
  endpoints:
    web:
      exposure:
        include:
          "*"   

위의 세 가지 설정 을 완료 하면 시스템 을 시작 합 니 다. 시작 로그 에 다음 로그 가 나타 납 니 다.

2020-07-24 11:45:37,506  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/archaius],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,508  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/auditevents],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,509  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/beans],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,509  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,510  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/conditions],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,510  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/configprops],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,510  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/env],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,510  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/env/{toMatch}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,512  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/env],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v2+json || application/json],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,512  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/env],methods=[DELETE],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,512  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,513  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/logfile],methods=[GET],produces=[application/octet-stream]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,513  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/loggers],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,513  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/loggers/{name}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,514  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/loggers/{name}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,514  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/heapdump],methods=[GET],produces=[application/octet-stream]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,514  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/threaddump],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,515  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/metrics/{requiredMetricName}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,515  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/metrics],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,515  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/scheduledtasks],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,516  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/httptrace],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,516  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/mappings],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,516  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/refresh],methods=[POST],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,516  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/features],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,516  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/service-registry],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,517  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/service-registry],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v2+json || application/json],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,518  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/routes],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,518  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/routes],methods=[POST],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,518  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/routes/{format}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,519  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator/filters],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)
2020-07-24 11:45:37,520  [INFO	] main org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping:AbstractHandlerMethodMapping.java:550- Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)

로그 에 있 는 actuator 와 관련 된 인 터 페 이 스 는 우리 가 접근 할 수 있 는 인터페이스 도 통과 할 수 있 습 니 다.http://ip주소: 포트 번호 / actuator 시스템 이 어떤 인터페이스 에 접근 할 수 있 는 지 보기
그 중에서 actuator / refresh 는 설정 인 터 페 이 스 를 새로 고치 기 위해 actuator / restart 인 터 페 이 스 는 서비스 인 터 페 이 스 를 다시 시작 합 니 다.
그러나 이 설정 은 노출 된 인터페이스 가 너무 많아 서 대부분 그 중 몇 개 만 사용 하고 싶 기 때문에 다음 과 같은 방식 으로 설정 할 수 있 습 니 다.
management:
  endpoint:
    refresh:
      enabled: true
    restart:
      enabled: true
  endpoints:
    web:
      exposure:
        include:
          refresh,restart

이 설정 은 endpoint 로 어떤 인터페이스 서 비 스 를 사용 해 야 하 는 지 설정 한 다음 include 에서 이 인터페이스의 경 로 를 설정 하면 됩 니 다.
여기 서 나 는 서 비 스 를 다시 시작 하고 설정 서 비 스 를 새로 고침 하 는 두 가지 서 비 스 를 설정 했다.다른 서 비 스 를 설정 하려 면 actuator 가 제공 하 는 인터페이스 에 따라 자체 적 으로 설정 할 수 있 습 니 다.

좋은 웹페이지 즐겨찾기