@Controller and @RestController differ in how they handle the return value of a method — one treats it as a view name to render, the other serializes it directly into the HTTP response body.
A @Controller method returning "home" triggers rendering of home.jsp, while a @RestController method returning a User object gets automatically converted to a JSON response body with no extra annotation needed.
A concise interview answer is
With @Controller, a returned String is resolved as a view name, and you need @ResponseBody on any method that should return raw data instead. @RestController bakes @ResponseBody into every method automatically, so it's built for APIs that return JSON or XML rather than rendered web pages.
Last updated: 11 November 2026
Previous question: When would you use @RestController instead of @Controller?
Next question: What are the implications of using @RestController for data serialization?