목차

Spring @MVC HandlerMethodArgumentResolver

구현

적용

<mvc:annotation-driven>
    <mvc:argument-resolvers>
        <bean class="kr.pe.kwonnam.someproject.LoginUserHandlerMethodArgumentResolver"/> <!--일반 Bean 주입 -->
    </mvc:argument-resolvers>
</mvc:annotation-driven>

혹은 java-config에서

@Override
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    super.addArgumentResolvers(argumentResolvers);
    argumentResolvers.add(myArgumentResolver());
    // ....
}

MethodParameter

ModelAndViewContainer

NativeWebRequest

HttpServletRequest httpServletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
Map<String,String> pathVariables = (Map<String, String>) httpServletRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
// pathVariables 맵에 정보가 저장 됨.

WebDataBinderFactory