Figure A
Figure II
Spring Workflow Description1. The user sends the request to the server, the request is captured by the spring front-end control Servelt dispatcherservlet; 2. Dispatcherservlet parses the request URL to get the request Resource Identifier (URI). Then, according to the URI, call handlermapping to obtain all related objects of the handler configuration (including handler objects and the interceptor corresponding to the handler object), and finally return as Handlerexecutionchain objects; 3. Dispatcherservlet according to the obtained handler, choose a suitable handleradapter. (
Notes: If the handleradapter is successfully obtained, the Prehandler (...) of the interceptor will start executing at this time. METHOD) 4. Extract the model data from the request, populate the handler entry, and start executing the handler (Controller). In the process of populating the handler, depending on your configuration, spring will do some extra work for you: Httpmessageconveter: Converts the request message (such as JSON, XML, and so on) to an object, converting the object to the specified response Information Data transformation: Yes, Request a message for data conversion. such as string conversion to Integer, double, and other data is radical: The request message is formatted data. Data validation such as converting a string to a formatted number or a formatted date: Verifies the validity of the data (length, format, and so on), and the validation results are stored in Bindingresult or error 5. Handler returns a Modelandview object to Dispatcherservlet after execution is complete; 6. Based on the returned Modelandview, select a suitable viewresolver (must be viewresolver already registered in the spring container) to return to Dispatcherservlet; 7. The Viewresolver combines model and view to render view 8. Returns the rendered result to the client.
Springmvc Work Flow chart