Question 1
How is an object returned from a @RestController method turned into the JSON response body?
A. Its toString() output is written directly to the response
Incorrect: the object's toString() output is not written directly to the response.
B. An HttpMessageConverter (e.g. MappingJackson2HttpMessageConverter) serializes it, selected via content negotiationCorrect answer
Correct: an HttpMessageConverter such as MappingJackson2HttpMessageConverter serializes the value, selected via content negotiation.
C. A ViewResolver renders it through a JSP template
Incorrect: a ViewResolver rendering a JSP is for view-based controllers, not @RestController JSON responses.
D. You must call Jackson's ObjectMapper manually in each handler
Incorrect: manually calling Jackson's ObjectMapper in each handler is unnecessary.
Explanation
Values returned from @ResponseBody/@RestController methods are serialized by an HttpMessageConverter chosen through content negotiation on the request's Accept header, with Jackson's converter producing JSON. View resolution applies to view-based controllers, and neither raw toString output nor manual serialization is involved.