DispatcherServlet

With Spring MVC, you don't have to create servlets. You can create a class and annotate it with the @Controller annotation and use the @RequestMapping annotation to map it to a certain URI pattern. By convention, the name of this class usually ends with Controller.

Spring uses a central servlet, the DispatcherServletto accept requests. This DispatcherServlet needs to be configured to process all requests and, based on the URI pattern specified in the @RequestMapping annotation, Spring will find a matching controller to handle a request.

The following diagram shows the request/response flow when using Spring MVC:

Figure ...

Get Building Applications with Spring 5 and Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.