diff --git a/animory/src/main/java/com/daggle/animory/common/config/WebConfiguration.java b/animory/src/main/java/com/daggle/animory/common/config/WebConfiguration.java index fdd2f3a9..d6dd5b50 100644 --- a/animory/src/main/java/com/daggle/animory/common/config/WebConfiguration.java +++ b/animory/src/main/java/com/daggle/animory/common/config/WebConfiguration.java @@ -1,20 +1,23 @@ package com.daggle.animory.common.config; import com.daggle.animory.common.logger.RequestLogger; +import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration +@RequiredArgsConstructor public class WebConfiguration implements WebMvcConfigurer { + private final RequestLogger requestLogger; @Override public void addInterceptors(final InterceptorRegistry registry) { // Request Logger 를 모든 요청에 대해 적용 - registry.addInterceptor(new RequestLogger()).order(-1); + registry.addInterceptor(requestLogger); } @Override diff --git a/animory/src/main/java/com/daggle/animory/common/logger/RequestLogger.java b/animory/src/main/java/com/daggle/animory/common/logger/RequestLogger.java index 3d3055ab..ad5cf706 100644 --- a/animory/src/main/java/com/daggle/animory/common/logger/RequestLogger.java +++ b/animory/src/main/java/com/daggle/animory/common/logger/RequestLogger.java @@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.lang.NonNull; +import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import javax.servlet.http.HttpServletRequest; @@ -15,6 +16,7 @@ * HTTP Request의 Method, URI, Query Parameter를 로깅합니다.* */ @Slf4j +@Component public class RequestLogger implements HandlerInterceptor { @Override