Skip to main content
About @RestController
- @RestController annotation, which marks the class as a controller where every method returns a domain object instead of a view.
- It is shorthand for including both @Controller and @ResponseBody.
- A key difference between a traditional MVC controller and the RESTful web service controller shown earlier is the way that the HTTP response body is created. Rather than relying on a view technology to perform server-side rendering of the greeting data to HTML, this RESTful web service controller populates and returns a Greeting object. The object data will be written directly to the HTTP response as JSON