springcloud 인터페이스 로 설정 재 부팅 및 읽 기
18536 단어 springSpringBootJAVAboot자바
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 가 제공 하 는 인터페이스 에 따라 자체 적 으로 설정 할 수 있 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
thymeleaf로 HTML 페이지를 동적으로 만듭니다 (spring + gradle)지난번에는 에서 화면에 HTML을 표시했습니다. 이번에는 화면을 동적으로 움직여보고 싶기 때문에 입력한 문자를 화면에 표시시키고 싶습니다. 초보자의 비망록이므로 이상한 점 등 있으면 지적 받을 수 있으면 기쁩니다! ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.