The preceding web controller has some key points:
@Controller indicates that this is a template-based web controller. Each web method returns the name of a template to render.
We are injecting the YouTube service through constructor injection, a concept touched upon back in Chapter 2, Creating a Web Application with Spring Boot.
The index method has a Spring MVC Model object, where we create a channelVideos attribute. It invokes our YouTube service’s channelVideos method with a channel ID, a page size of 10, and uses view counts as the way to sort search results.
The name of the template to render is index.