-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Michael Osipov opened SPR-10163 and commented
There is at the moment no easy way to modify RequestMappingHandlerMapping
's setters. Namely, I had to set setUseSuffixPatternMatch(false)
. mvc:annotation-driven does not allow to change this bean. There is a Java equivalent
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
@Override
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
RequestMappingHandlerMapping hm = super.requestMappingHandlerMapping();
hm.setSuffixPatternMatch(false);
return hm;
}
}
Which does not really work if you mix XML and Java config because this class is called when all URL handlers have been already registered.
I have found issue #14007 which solves the problem but is somewhat tedious in implementation.
Can we have mvc:annotation-driven extended in such a way that exactly such such can be done in XML?
If this does not require any extension please add a doc chapter which shows how to do this with XML. There are only examples in Java whether it's the Spring Docs or Stackoverflow.
Something like this should work too:
<beans:bean
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" p:order="0" p:useSuffixPatternMatch="false" />
Which actually doesn't!
Another reference: http://forum.springsource.org/showthread.php?120192
Affects: 3.1.3
Issue Links:
- Allow configuring RequestMappingHandlerMapping in mvc:annotation-driven [SPR-11253] #15878 Allow configuring RequestMappingHandlerMapping in mvc:annotation-driven ("is duplicated by")
- Backport MVC config path config options to 3.2.x [SPR-14186] #18757 Backport MVC config path config options to 3.2.x
- Expose path-related request mapping settings in the MVC Java config [SPR-11486] #16111 Expose path-related request mapping settings in the MVC Java config
Referenced from: commits eac4881, 96b418c, fc05df0, 8edb7a1, 80a16c6
9 votes, 10 watchers