A view resolver is a Spring MVC component that finds the view named by a controller and provides its content. It handles the step between a controller returning a page name and the dispatcher servlet sending the rendered view in the HTTP response. section 7.3
For a page request, the flow is:
- The dispatcher servlet uses the request to find a controller action. section 7.3
- The controller returns a page name, such as home.html. section 7.3
- The dispatcher servlet delegates finding that view’s content to the view resolver, then returns the rendered view in the response. section 7.3
A controller returning a page name
A controller action mapped to /home can return "home.html". The resolver’s role is to locate that view’s content; the dispatcher servlet uses it to produce the response. section 7.3
REST endpoints take a different path: the dispatcher servlet returns the controller’s result directly, so the flow does not use a view resolver. section 10.1
