Actuator
ํ์ฌ ๊ธฐ๋ํ๊ณ ์๋ ์ดํ๋ฆฌ์ผ์ด์ ์ ์ํ๋ฅผ ์ฝ๊ฒ monitoringํ ์ ์๋ค.
ํ์ฌ ์๋ฒ๊ฐ ๊ตฌ๋ ์ค์ธ์ง๋ ํ์ธ ๊ฐ๋ฅ
๊ธฐ๋ณธ ์ ๊ณตํ๋ ๋งํฌ๋ฅผ ๋ณ๋๋ก ์ปค์คํฐ๋ง์ด์งํด์ ์ฌ์ฉํ๋ฉด ๋ ์ข๋ค.
Actuator ๊ตฌํ
dependency ์ถ๊ฐ
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
์๋ฌ
Actuator๋ PathPatternParser๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์ง๋ Swagger ์ค์ ์์ ํ์ฉํด์คฌ๋ yml ์ค์ ์ผ๋ก๋ ํด๊ฒฐ๋์ง ์๋๋ค.
org.springframework.context.ApplicationContextException:
Failed to start bean 'documentationPluginsBootstrapper';
https://github.com/springfox/springfox/issues/3462
spring fox์์ ์ ๋ฐ์ดํธ๋ฅผ ์ ํด์ ์๊ธด ๋ฒ์ ์ด์๋ก ์๋ ์ฝ๋๋ฅผ ์ค์ ํด์ฃผ๋ฉด ๋๋ค.
SwaggerConfig.java ์์ bean ์ค์ ํด์ฃผ๊ธฐ
@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));
}
๋งํฌ ์ ์
http://localhost:8088/actuator
http://localhost:8088/actuator/health → ์๋ฒ๊ฐ ์๋ ์ค์ธ์ง ํ์ธํ ์ ์๋ค
application.yml ์ค์
์กฐ๊ธ ๋ ๋ค์ํ ํ์ผ์ ๋ณผ ์ ์๋ค.
# actuator ์ค์
management:
endpoints:
web:
exposure:
include: "*"
'๐ฟ Spring' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Spring Boot/RESTful] Spring Security๋ฅผ ์ด์ฉํ ๋ก๊ทธ์ธ (0) | 2022.02.18 |
---|---|
[Spring Boot/RESTful] HAL Browser(Explorer) (+๋ฒ์ ์๋ฌ) (0) | 2022.02.18 |
[Spring Boot/RESTful] Swagger ์ค์ (+๋ฒ์ ์ค๋ฅ) (0) | 2022.02.18 |
[Spring Boot/RESTful] REST API 3๋จ๊ณ๋ฅผ ์ํ HATEOAS ์ค์ (0) | 2022.02.18 |
[Spring boot/RESTful] REST API ๋ฒ์ ๊ด๋ฆฌ (0) | 2022.02.18 |
๋๊ธ