Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 윤곽선검출
- 이것이자바다확인문제
- 카카오코테
- 백준평범한배낭
- 백준9012
- 백준가운데를말해요
- BOJ
- java
- 코딩테스트실력진단
- 코테
- 백준
- BOJ1655
- 이것이자바다9장
- 딥러닝
- 합성곱연산
- 코드트리
- 스파르타코딩클럽
- 이것이자바다
- 백준10828
- 운영체제
- KT포트포워딩
- 백준스택
- 가운데를말해요
- 웹개발기초
- 냅색알고리즘
- 백준괄호
- 컴퓨터비전
- 백준온라인저지
- 확인문제
- 2019카카오코테
Archives
- Today
- Total
코딩하는 락커
[Spring Boot를 이용한 RESTful Web Services 개발] 31강 본문
🍃 Spring/🌱 Spring Boot를 이용한 RESTful Web Service
[Spring Boot를 이용한 RESTful Web Services 개발] 31강
락꿈사 2022. 3. 3. 17:46REST API Monitoring을 위한 Actuator 설정
- 스프링 부트 프로젝트에 모니터를 하는 기능 제공
- Spring boot starter Component의 Acutator 라이브러리 추가 (이것만으로도 간단하게 어플리케이션의 상태를 쉽게 파악할 수 있음)
- pom.xml에 의존성 추가
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.6.2</version>
</dependency>
- application.yml에 내용 추가
- 더 많은 정보를 확인할 수 있음
management:
endpoints:
web:
exposure:
include: "*"
- SwaggerConfig 클래스에 추가 (이 내용을 추가하지 않으면 에러남. 링크 참고)
@Bean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
String basePath = webEndpointProperties.getBasePath();
EndpointMapping endpointMapping = new EndpointMapping(basePath);
boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
}
private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
}


'🍃 Spring > 🌱 Spring Boot를 이용한 RESTful Web Service' 카테고리의 다른 글
[Spring Boot를 이용한 RESTful Web Services 개발] 33~34강 (0) | 2022.03.05 |
---|---|
[Spring Boot를 이용한 RESTful Web Services 개발] 32강 (0) | 2022.03.05 |
[Spring Boot를 이용한 RESTful Web Services 개발] 29~30강 (0) | 2022.03.03 |
[Spring Boot를 이용한 RESTful Web Services 개발] 27~28강 (0) | 2022.02.11 |
[Spring Boot를 이용한 RESTful Web Services 개발] 25~26강 (0) | 2022.02.09 |
Comments