@RestController tells Spring to serialize every handler method's return value directly into the HTTP response body — typically as JSON via Jackson — rather than treating it as a logical view name. This shapes both how simple API code becomes and what the controller can no longer do.
A method returning a Product object from a @RestController is automatically serialized to {"id":1,"name":"Widget","price":9.99} in the response body, with no manual JSON conversion code required.
A concise interview answer is
@RestController means every return value gets serialized straight into the response body by an HttpMessageConverter, usually Jackson producing JSON, which is what makes it ideal for APIs. The tradeoff is that the same controller can't return a view name for HTML rendering, so mixed API-and-page apps typically split those concerns into separate controllers.
Last updated: 16 July 2026
Previous question: How does response handling differ between @Controller and @RestController?
Next question: How do you manage form data in Spring MVC?