What is a controller and which is HandlerMapping in Spring MVC?

I use this link to learn Spring MVC. As described, the dispatcher servlet is at the top of the processing of all incoming requests.

It also describes what HandlerMapping and Controller are. However, only the controller is used in the source code. What is HandlerMapping? Isn't that a separate file?

Or is he present in some other complicated scenario?

+5
source share
4 answers

If the handler mapping is not explicitly specified in the configuration, it BeanNameUrlHandlerMappingis created and used by default.

From the article you pointed out:

" DispatcherServlet BeanNameUrlHandlerMapping . BeanNameUrlHandlerMapping bean URL. BeanNameUrlHandlerMapping , ".

+8

HandlerMapping - Spring MVC. - java, . @Controller . HandlerMapping Spring. Spring hanlder, BeanNameUrlHandlerMapping, ControllerClassNameHandlerMapping .. BeanNameUrlHandlerMapping. , .

+8

. bean . bean DefaultUrlHandlerMapping.

bean URL-. URL- bean. , DispatcherServlet , , - ModelAndView .

0
  • DispatcherServlet HandlerMapping , .
  • Controller , ModeAndView DispatcherServlet.
  • Controller - , .. Controller . Controllers.
  • HandlerMapping. The strategy is HandlerMappingused to map the HTTP client request to some controller (or controllers) of the controller and / or method. This is done based on the request URL and the HTTP method, but may also include request parameters, request headers, or other custom factors. for example, SimpleUrlHandlerMappingor BeanNameUrlHandlerMapping.
-1
source

All Articles