Please tell me whether it is possible to use both SimpleUrlHandlerMapping and AnnotationMapping in spring mvc.
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can have as many as you like. Each will be consulted until one of them says “yes, I have a mapping for that request”.
Declare each of them in your beans file like any other bean, they’ll be consulted in the order in which they appear.
However, by default,
DispatcherServletregisters three differentHandlerMappingbeans automatically,HttpRequestHandlerAdapter,SimpleControllerHandlerAdapter, andAnnotationMethodHandlerAdapter, so it’s possible you don’t need to do this yourself – you can mix-and-match handlers from all three styles, and Spring will handle it out of the box.