|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package kr.xit.core.spring.config;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import javax.servlet.DispatcherType;
|
|
|
|
@ -22,6 +24,9 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
|
import org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter;
|
|
|
|
|
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
|
|
|
|
import org.springframework.web.filter.CommonsRequestLoggingFilter;
|
|
|
|
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
|
@ -65,6 +70,16 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
|
|
|
|
|
|
private final CorsProperties corsProperties;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MappingJackson2XmlHttpMessageConverter 순서를 가장 후순위로 조정
|
|
|
|
|
* @param converters
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
|
|
|
// XML 관련 HttpMessageConverter 의 우선순위를 최하위로 낮추는 메소드
|
|
|
|
|
reorderXmlConvertersToEnd(converters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
|
registry.addInterceptor(new AuthentificationInterceptor())
|
|
|
|
@ -167,6 +182,23 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
|
resolvers.add(new PageableArgumentResolver());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MappingJackson2XmlHttpMessageConverter 를 가장 후순위로 조정하는 메소드
|
|
|
|
|
* @param converters
|
|
|
|
|
*/
|
|
|
|
|
private void reorderXmlConvertersToEnd(List<HttpMessageConverter<?>> converters) {
|
|
|
|
|
List<HttpMessageConverter<?>> xml = new ArrayList<>();
|
|
|
|
|
for (Iterator<HttpMessageConverter<?>> iterator =
|
|
|
|
|
converters.iterator(); iterator.hasNext();) {
|
|
|
|
|
HttpMessageConverter<?> converter = iterator.next();
|
|
|
|
|
if ((converter instanceof AbstractXmlHttpMessageConverter)
|
|
|
|
|
|| (converter instanceof MappingJackson2XmlHttpMessageConverter)) {
|
|
|
|
|
xml.add(converter);
|
|
|
|
|
iterator.remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
converters.addAll(xml);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * HandlerExceptionResolver 를 상속받은 resolver 등록
|
|
|
|
|