Spring 3.x MVC MVC the whole process diagram

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Spring MVC life cycle

Before you start using spring MVC, we must need to know SPRING MVC process, as shown below:

Looking at some instructions below before (described below: HandlerMapping, HandlerAdapter, HandlerExceptionResovler, ViewResolver has a order attribute, Because each of these interfaces can register multiple implementation, Order on behalf of their order of execution, Order is the first implementation of the smaller, The first general implementation of matching the back is not executed.)

DispatcherServlet: The front controller of the Spring MVC, which took over the request from the client

HandlerMapping: DispatcherServlet will use it to handle client requests to each of the processors mapping (Controller)

HandlerAdapter: HandlerMapping will use that to call the Controller method to be executed

HandlerExceptionResolver: spring MVC process, if an exception is thrown, will give it to the exception handling

ViewResolver: HandlerAdapter will take Controller call returns the final packaging into ModelAndView, ViewResolver will check the view, If view is a string, It is responsible for processing the string and returns a real View, If view is a real View is not over to it for processing, Why view can be a string will be explained below View

View: corresponds to MVC V, the interface has a method for render, view

ModelAndView to solve the above ViewResoler or below the picture of the doubt, this class of the view attribute is Object type, it can be a view name can also be a real View, we observed the source can be seen clearly

private Object view;

public void setViewName(String viewName) {

   this.view = viewName;


public String getViewName() {

  return (this.view instanceof String ? (String) this.view : null);


public void setView(View view) {

  this.view = view;


public View getView() {

  return (this.view instanceof View ? (View) this.view : null);


Flow chart of Spring MVC

If you can't see or not see chart, please click on the link below, the picture is too large, the process starting from the middle of the top of the Client entrance

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Rudolf at July 26, 2014 - 1:04 AM