diff --git a/mens-core/src/main/java/kr/xit/core/spring/config/WebMvcConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/WebMvcConfig.java index 4df8a4f..9e6f6c7 100644 --- a/mens-core/src/main/java/kr/xit/core/spring/config/WebMvcConfig.java +++ b/mens-core/src/main/java/kr/xit/core/spring/config/WebMvcConfig.java @@ -14,7 +14,6 @@ import kr.xit.core.spring.config.auth.AuthentificationInterceptor; import kr.xit.core.spring.config.properties.CorsProperties; import kr.xit.core.spring.filter.LoggingFilter; import kr.xit.core.spring.filter.ReadableRequestWrapperFilter; -import kr.xit.core.spring.resolver.JsonPathArgumentResolver; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; @@ -29,7 +28,6 @@ import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConve import org.springframework.web.filter.CommonsRequestLoggingFilter; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -59,7 +57,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; */ @RequiredArgsConstructor @Configuration -@EnableWebMvc public class WebMvcConfig implements WebMvcConfigurer { /** * logging exclude path @@ -182,7 +179,7 @@ public class WebMvcConfig implements WebMvcConfigurer { //TODO :: ArgumentResolver add @Override public void addArgumentResolvers(List resolvers) { - resolvers.add(new JsonPathArgumentResolver()); + // resolvers.add(new CustomArgumentResolver()); // resolvers.add(new PageableArgumentResolver()); } diff --git a/mens-core/src/main/java/kr/xit/core/spring/resolver/HtmlViewResolver.java b/mens-core/src/main/java/kr/xit/core/spring/resolver/HtmlViewResolver.java new file mode 100644 index 0000000..db214d0 --- /dev/null +++ b/mens-core/src/main/java/kr/xit/core/spring/resolver/HtmlViewResolver.java @@ -0,0 +1,37 @@ +package kr.xit.core.spring.resolver; + +import java.util.Locale; +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.view.AbstractUrlBasedView; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; + +/** + *
+ * description : 리소스 요청에 "html/"가 존재하면 HtmlViewResolver가 처리하도록 한다. 존재하지 않으면 null을 반환
+ * packageName : kr.xit.core.spring.resolver
+ * fileName    : HtmlViewResolver
+ * author      : julim
+ * date        : 2023-10-04
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2023-10-04    julim       최초 생성
+ *
+ * 
+ */ +public class HtmlViewResolver extends InternalResourceViewResolver { + @Override + protected View loadView(String viewName, Locale locale) throws Exception { + AbstractUrlBasedView view = buildView(viewName); + View viewObj = (View) getApplicationContext().getAutowireCapableBeanFactory().initializeBean(view, viewName); + if (viewObj instanceof JstlView) { + JstlView jv = (JstlView) viewObj; + if (jv.getBeanName().indexOf(".html") == -1) { + return null; + } + } + return viewObj; + } + +} diff --git a/mens-core/src/main/java/kr/xit/core/spring/resolver/JspViewResolver.java b/mens-core/src/main/java/kr/xit/core/spring/resolver/JspViewResolver.java new file mode 100644 index 0000000..83a73c4 --- /dev/null +++ b/mens-core/src/main/java/kr/xit/core/spring/resolver/JspViewResolver.java @@ -0,0 +1,38 @@ +package kr.xit.core.spring.resolver; + +import java.util.Locale; + +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.view.AbstractUrlBasedView; +import org.springframework.web.servlet.view.JstlView; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +/** + *
+ * description : 리소스 요청에 "jsp/"가 존재하면 JspViewResolver가 처리하도록 한다. 존재하지 않으면 null을 반환
+ * packageName : kr.xit.core.spring.resolver
+ * fileName    : JspViewResolver
+ * author      : julim
+ * date        : 2023-10-04
+ * ======================================================================
+ * 변경일         변경자        변경 내용
+ * ----------------------------------------------------------------------
+ * 2023-10-04    julim       최초 생성
+ *
+ * 
+ */ +public class JspViewResolver extends InternalResourceViewResolver { + @Override + protected View loadView(String viewName, Locale locale) throws Exception { + AbstractUrlBasedView view = buildView(viewName); + View viewObj = (View) getApplicationContext().getAutowireCapableBeanFactory().initializeBean(view, viewName); + if (viewObj instanceof JstlView) { + JstlView jv = (JstlView) viewObj; + if (jv.getBeanName().indexOf(".jsp") == -1) { + return null; + } + } + return viewObj; + } + +}