Spring's MVC execution principle
1. Spring Mvc submits all requests to dispatcherservlet, which delegates other modules of the application system to the request To do the real processing work. 2.dispatcherservlet query one or more handlermapping to find the controller4.controller business logic is processed and returns a Modelandview5.dispathcher query one or more viewresolver View parser The Modelandview object specifies the View object 6. The View object is responsible for rendering back to the client .
1. Using spring's IOC container, the dependencies between the objects are given to spring, and the coupling between the components is reduced, allowing us to focus more on the application logic
3.AOP is very good support, instant noodles programming to the plane.
The 5.Spring di mechanism reduces the complexity of business object substitution.
The 7.Spring is highly open and does not force reliance on spring, and developers are free to select part or all of spring
SPRINGMVC Execution Process :
- User initiated the request to the front-end director (Controller)
- The front-end controller does not have the ability to handle business logic and needs to find specific Model object processing (Handler) to find the Handler object (model) in the Processor mapper (handlermapping).
- Handlermapping returns the execution chain with 2 sections: ①handler object, ② Interceptor Array
- Front executes the handler object after wrapping it through the processor adapter.
- Process business logic.
- Handler finishes processing the business logic and returns the Modelandview object, where view is the view name and not the real view object.
- Return the Modelandview to the front-end controller.
- The View parser (Viewresolver) returns a true View object.
- (At this point the front controller has both a view and model object data) the front-end controller renders the view based on the model data and view objects.
- Returns the rendered view (Html/json/xml).
- Generate a response to the user.
SPRINGMVC execution Process and principle