This video expands on the existing knowledge of controllers from the previous chapter, discussing the RestController and how it differs as well as how it is the same.
- [Instructor] So now we're going to take a few minutes…and talk about the RestController…and how it's the same as the traditional controller…that we just walked through,…as well as some of the differences.…So much in the same way that the standard…at controller annotation works,…the RestController provides the RequestMapping interace…to the dispatcher's servlet,…which controls the URL to method mapping,…and it proves a model to "view" mapping.…And I have view in quotes there because in reality,…an XML body is just another type of view…for an HTTP request.…
It's no different than an HTML body,…except for that instead of displaying purely in a browser,…it can be read by systems and other processes.…Now, one of the biggest ways that it's different…than the standard controller is it actually annotates…every method in the class by default with a response body,…and what allows you to do is instead of just simply…returning a string that gets mapped to a template,…you can return an object,…and that object is marshaled to either XML or JSON,…
- Creating a project with Spring Initializr
- Examining the Spring Boot skeleton project with Spring Data JPA
- Creating an embedded database for Spring Boot development and testing
- Building a service abstraction
- Using the IoC paradigm in Spring to develop a service layer
- Building a controller
- Testing a controller MockMvc
- Exposing a service layer through REST
Skill Level Intermediate
Q: This course was updated on 09/06/2018. What changed?
A: The following topics were updated: creating a project with Spring Initializr, examining the Spring Boot skeleton project, developing a service object with Spring, and testing a controller MockMvc.