NOTE
2.7 Introduction
Spring MVC components and request-processing flow.
This is a historical learning note and may contain outdated or incomplete understanding.
Components
Core: DispatcherServlet.
Three major components: HandlerMapping, HandlerAdapter, ViewResolver.
Written by the user: Handler, View.
Flow
- The user sends a request to the front controller DispatcherServlet.
- After receiving the request, DispatcherServlet calls the HandlerMapping handler mapper.
- The handler mapper finds the specific handler according to the request URL, creates the handler object and handler interceptor (if any), and returns them together to DispatcherServlet.
- DispatcherServlet invokes the handler through the HandlerAdapter.
- Execute the handler (Controller, also called the backend controller).
- After execution, the Controller returns ModelAndView.
- HandlerAdapter returns the Controller execution result ModelAndView to DispatcherServlet.
- DispatcherServlet passes ModelAndView to the ViewResolver.
- After resolution, ViewResolver returns the specific View.
- DispatcherServlet renders the View (that is, fills the model data into the view).
- DispatcherServlet responds to the user.

Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub