The next step is to add Spring MVC capabilities. In the previous step, the required starter dependencies for the web are added to the pom.xml file. Next, we will define Spring MVC artifacts in our application.
Since this is a Spring Boot application, we are not required to declare everything from scratch. It is essential to define the controllers and view layer. First, we will declare a Spring MVC controller, as in the following snippet:
@Controller
public class BlogController {
private Logger logger = LoggerFactory.getLogger(BlogController.class);
@GetMapping("/")
public String showLandingPage(Model model) {
logger.info("This is show home page method ");
return "home";
}
}
The @Controller annotation describes this class as a Spring MVC controller. It basically instructs the Spring Boot application...