Skip to content

Expose path-related request mapping settings in the MVC XML namespace [SPR-10163] #14796

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits eac4881, 96b418c, fc05df0, 8edb7a1, 80a16c6

9 votes, 10 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions