Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10163

Expose path-related request mapping settings in the MVC XML namespace

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.1.3
    • Fix Version/s: 4.0.1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      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 SPR-9371 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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bclozel Brian Clozel
                Reporter:
                michael-o Michael Osipov
                Last updater:
                Juergen Hoeller
              • Votes:
                9 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 47 weeks, 2 days ago