0

I have a controller with @RequestMapping for root path "/". There are other controllers with say a @RequestMapping of "/test" etc. My application seems to be mapping correctly for paths like /appname/test, but if I add a trailing slash to the path, like so "/appname/test/ then it maps to the controller that has the @RequestMapping for root path "/". Any idea why?

Update:

I also tried removing <mvc:annotation-driven /> and replacing with

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"
   p:order="0" p:alwaysUseFullPath="true" /> 
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" 
   p:alwaysUseFullPath="true"/> 

That fixed the trailing slash problem, but my validations stopped working

0

1 Answer 1

1

Looks like a bug (SPR-7064), fixed in 3.0.3, should be out soon.

Sign up to request clarification or add additional context in comments.

3 Comments

hmm, wondering how petclinic sample works okay! It was built with 3.0.0. My app is on 3.0.2, maybe I will go back to 3.0.0
@Eqbal: Alternatively, you could add more path mappings as a workaround. @RequestMapping can take multiple paths.
That does not work, anything with a trailing slash maps to root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.