What is the DispatcherServlet and what is it used for?

Technology CommunityCategory: TestingWhat is the DispatcherServlet and what is it used for?
VietMX Staff asked 3 years ago

The DispatcherServlet is an implementation of the Front Controller design pattern that handles all incoming web request to a Spring MVC application. A Front Controller pattern (see Enterprise application design pattern) is a common pattern in web applications whose job is to receive all request and route it to different components of the application for actual processing.

In Spring MVC, DispatcherServlet is used for finding the correct Controller to process a request, which it does with the help of handler mapping, e.g. the @RequestMapping annotation.