Answer:
ðððŽðĐðĻð§ðŽðððĻððē annotation is a step further from a classic MVC approach to a REST approach
when ððĒðð°ðððŽðĻðĨðŊððŦ is not needed and request-handler result might be directly written to the http-response body.
ðððŽðĐðĻð§ðŽðððĻððē annotation does exactly that, enabling functionality offered by ððððĐðððŽðŽðð ðððĻð§ðŊððŦðððŦ message-converters.
Note: ðððŽðĐðĻð§ðŽðððĻððē annotation might be applied at a type level,
thus all handler methods declared within that type will inherit declared behavior.
The @ResponseBody annotation tells a controller that the object returned is automatically serialized into JSON and passed back into the HttpResponse object.
Suppose we have a custom Response object:
Next, the associated controller can be implemented:
In the developer console of our browser or using a tool like Postman, we can see the following response:
{"ðððąð":"ððĄðð§ðĪðŽ ð ðĻðŦ ððĻðŽððĒð§ð !!!"}
Remember, we don't need to annotate the @RestController-annotated controllers with the @ResponseBody annotation since Spring does it by default.
#spring #certificationquestion #vcp
@ResponseBody ð https://www.baeldung.com/spring-request-response-body#requestbody