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: Request messages such as JSON, Data such as XML) into an object that converts the object to the specified response information Data Transformation: Data conversion for a request message. such as string conversion to Integer, double data Radical: Data formatting of the request message. such as converting strings to formatted numbers or formatted dates data validation: Verifying the validity of the data (length, format, and so on), and verifying that the results are stored in Bindingresult or error 5. When handler executes, returns a Modelandview object; 6 to dispatcherservlet . Based on the returned Modelandview, select a suitable viewresolver (must be viewresolver already registered in the spring container) to return to dispatcherservlet ; 7. viewresolver combines model and view to render the view 8. Returns the rendered result to the client. spring Workflow Description Why does spring use only one servlet (Dispatcherservlet) to handle all requests? Detailed view of the Java EE design mode-front-end control mode Why does spring use a combination of HAndlermapping and Handleradapter to handle handler? conform to the single principle of responsibility in object-oriented, the code structure is clear, easy to maintain, and most importantly, the code is highly reusable. such as handleradapter may be used to handle a variety of handler. Transferred from: http://blog.csdn.net/zuoluoboy/article/details/19766131/
Spring MVC process