Skip to content

HandlerMapping

HandlerMapping is a core component within the Spring MVC architecture, functioning as a strategy interface used by the DispatcherServlet.^[600-developer-java-spring-dispatcherservlet.md]

Function

The primary role of HandlerMapping is to map incoming web requests to specific handlers (controllers) based on the URL or other request characteristics.^[600-developer-java-spring-dispatcherservlet.md]

Common Implementations

The framework provides several standard implementations to handle different mapping strategies^[600-developer-java-spring-dispatcherservlet.md]:

  • BeanNameUrlHandlerMapping: Maps handlers to URLs based on the bean's name.
  • RequestMappingHandlerMapping: Maps handlers based on @RequestMapping annotations.

Sources

^[600-developer-java-spring-dispatcherservlet.md]