The lifecycle of a Spring MVC request describes the path an HTTP request takes from arriving at the server to producing a rendered response, coordinated by DispatcherServlet as the central front controller.
Key Points: • DispatcherServlet receives every incoming request first and consults a HandlerMapping to find the right controller method. • Any registered interceptors run their preHandle() method before the controller executes. • The controller method runs, typically interacting with services and the model, and returns a view name or a ModelAndView. • Interceptors' postHandle() runs next, followed by ViewResolver resolving the logical view name into an actual View. • The View renders the model data into the final response body, and interceptors' afterCompletion() runs last for cleanup or logging.
Example: A request for /orders/42 is routed by DispatcherServlet to OrderController, which loads the order via a service, puts it on the model, and returns "orderDetail"; ViewResolver then maps that to orderDetail.jsp, which renders the final HTML sent back to the browser.
Interview Tip: A concise interview answer is:
"Every request enters through DispatcherServlet, which finds the matching controller via HandlerMapping. The controller processes the request, working with the model, and returns a view name. DispatcherServlet passes that to a ViewResolver to get an actual View, which renders the response — with interceptors able to hook in before and after each stage."