I\'m using Spring MVC (3.0) with annotation-driven controllers. I would like to create REST-ful URLs for resources and be able to not require (but still opt
Spring 3.2 has changed, and suggests that you set properties on the RequestMappingHandlerMapping
bean, either explicitly (if not using the mvc namespace) or by using a BeanPostProcessor such as the following (you'll need to scan or instantiate it):
@Component
public class IncludeExtensionsInRequestParamPostProcessor implements BeanPostProcessor {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof RequestMappingHandlerMapping) {
RequestMappingHandlerMapping mapping = (RequestMappingHandlerMapping)bean;
mapping.setUseRegisteredSuffixPatternMatch(false);
mapping.setUseSuffixPatternMatch(false);
}
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) { return bean; }
}
You can also just append :.*
to your @RequestMapping, e.g. "/{documentPath:.*}"
(see JIRA comment)