Announcement Announcement Module
No announcement yet.
XML equivelent of <mvc:annotation-driven /> Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML equivelent of <mvc:annotation-driven />


    I'm using spring mvc (version 3.0.7.RELEASE), with <mvc:annotation-driven /> to detect @Controller and @RequestMapping etc.

    However, I find the default of useTrailingSlashMatch=true very annoying (because if someone goes to site/mypage/ all my relative links suddenly stop working...)

    I've seen a few posts on stackoverflow etc showing the expanded xml equivalent of annotation-driven, and one of the beans in the expansion allows to set useTrailingSlashMatch. However, the examples I've seen are for spring 3.1.

    Does anyone know how I work out what the equivalent xml is for mvc:annotation-driven in 3.0.7?

    Thanks in advance.

  • #2
    <mvc:annotation-driven /> registers RequestMappingHandlerMapping, RequestMappingHandlerAdapter, ExceptionHandlerExceptionResolver, and ConversionService.

    The feature that you are looking for is I believe setUseTrailingSlashMatch(boolean useTrailingSlashMatch) of RequestMappingHandlerMapping bean. So, if you register these beans manually you can specify it.

    However, this bean is available since 3.1 and not present in 3.0.7 so you will have to upgrade. See this link


    • #3
      Thanks for that - I'd missed that useTrailingSlashMatch was only added in 3.1. An upgrade isn't an option at the moment and useDefaultSuffixPattern turns off too much behaviour. Shame.

      Thanks anyway.