Different between the annotations @controller and @restcontroller?
Loading
Different between the annotations @controller and @restcontroller?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Oct 13, 2022, 12:36 PM
@RestController is a convenience annotation that does nothing more than adds the @Controller and @ResponseBody annotations in single statement. A key difference between a traditional MVC @Controller and the RESTful web service @RestController is the way that the HTTP response body is created. Rather than relying on a view technology to perform server-side rendering of the data to HTML, rest controller simply populates and returns the domain object itself. The object data is be written directly to the HTTP response as JSON or XML and parsed by client to further process it either for modifying the existing view or for any other purpose.
Using @Controller in spring mvc application
Using @Controller with @ResponseBody in spring
Using @RestController in spring