Spring - use both simple SimpleUrlHandlerMapping and AnnotationMapping

Please tell me whether it is possible to use both SimpleUrlHandlerMapping and AnnotationMapping in spring mvc.

Thank.

+3
source share
1 answer

Yes, you can have as much as you want. Each of them will consult until one of them says "yes, I have a mapping for this request."

Declare each of them in your beans file, like any other bean, they will be handled in the order in which they appear.

DispatcherServlet HandlerMapping beans, HttpRequestHandlerAdapter, SimpleControllerHandlerAdapter AnnotationMethodHandlerAdapter, - mix-and-match- , Spring .

+3

Source: https://habr.com/ru/post/1739124/


All Articles