Spring REST JSON response
Spring’s annotation and returning the object that we want to send to the client.
The annotation tells Spring that we will be returning data in the response body rather than rendering a JSP.
When the annotation is used, Spring will return the data in a format that is acceptable to the client.
If the client request has a header to accept JSON and Jackson-Mapper is present in the classpath, then Spring will try to serialize the return value to JSON.
If the request header indicates XML as acceptable (accept= application/xml) and Java Architecture for XML Binding (JAXB) is in the classpath and the return type is annotated with JAXB annotation, Spring will try to marshall the return value to XML.