Hi,
I needed to extend WebMvcConfigurationSupport in order to replace the default RequestMappingHandlerMapping. However, I still want to use as much XML configuration as possible. It seems that some XML configurations work while others don't. Is mixing XML configurations and WebMvcConfigurationSupport supported/recommended?
ExtendedWebMvcConfiguration:
Dispatcher Servlet Context:Code:@Configuration public class ExtendedWebMvcConfiguration extends WebMvcConfigurationSupport { @Override @Bean public RequestMappingHandlerMapping requestMappingHandlerMapping() { ExtendedRequestMappingHanderMapping handlerMapping = new ExtendedRequestMappingHanderMapping(); handlerMapping.setOrder(0); handlerMapping.setInterceptors(getInterceptors()); return handlerMapping; } }
UPDATE: <mvc:interceptors> actually works here. The real problem is that it seems Spring Expressions (#{'/test/**'}) are not evaluated in <mvc:mapping>! Can someone explain why?Code:<bean id="extendedWebMvcConfig" class="com.example.ExtendedWebMvcConfiguration" /> <!-- SEEMS TO WORK --> <mvc:resources mapping="#{resourcesConfig.path}/**" location="/resources/" /> <!-- DOES NOT SEEM TO WORK --> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="#{'/test/**'}" /> <bean class="com.example.interceptors.TestInterceptor" /> </mvc:interceptor> </mvc:interceptors>
Thanks,
Andy


Reply With Quote
