Announcement Announcement Module
Collapse
No announcement yet.
Configuring RequestMappingHandlerMapping when using mvc:annotation-driven Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring RequestMappingHandlerMapping when using mvc:annotation-driven

    Hello,
    What happened to #spring? Anyway...

    Is there a sensible way to set RequestMappingHandlerMapping.useSuffixPatternMatch to false when I using <mvc:annotation-driven> in the XML config?

    This is for Spring 3.1 by the way.

    Cheers,
    M

  • #2
    The MVC Java config in Spring 3.1 provides the same benefits the the MVC namespace but also makes it easier to customize properties on the underlying beans:

    Code:
    @Configuration
    public class WebConfig extends WebMvcConfigurationSupport {
    
      @Override
      @Bean
      public RequestMappingHandlerMapping requestMappingHandlerMapping() {
        RequestMappingHandlerMapping hm = super.requestMappingHandlerMapping();
        hm.setSuffixPatternMatch(false);
        return hm;
      }
    
    }
    See the Javadoc on @EnableWebMvc or the reference documentation for more details.

    Comment


    • #3
      Works as expected

      I tried this approach with the application that is configured using XML and I removed annotation-driven from it and added @EnableWebMvc annotated configuration class and this works fine.

      Is this good approach to mix XML and JAVA configurations? Some of the mvc configuration (interceptors, view resolvers) are in XML, some in JAVA config.

      What's your opinion?

      Comment

      Working...
      X