A view is the page content rendered for a web response. A controller action returns a view name; the DispatcherServlet asks a View Resolver for the matching view, then returns its rendered content. Spring Boot configures these components, leaving application code to define controller actions. For REST endpoints, use @ResponseBody or @RestController; otherwise, Spring assumes the method returns a view name. section 7.3 section 10.6
Listing 7.5 The definition of the controller class
@Controller #A
public class MainController {
@RequestMapping("/home") #B
public String home() {
return "home.html"; #C
}
}This controller maps /home to the view name home.html, illustrating how a controller selects a view for rendering. section 7.3







