Migrating @ResponseBody to ResponseEntity


I have an old controller with a method that returns an object as json and marked with @ResponseBody.

The problem is that the status code is always 200, although sometimes it isn’t.

The current method signature is:

public MyResponse myMethod(){}

and I want to change it to:

public ResponseEntity<MyResponse> myMethod(){}

All of that is not a problem, but I afraid that it clients that use this controller will fail to parse the response. Is that possible? do Spring wraps the response with another object?


No it doesn’t. The response will be the same.
No. The client will not have any issues



Add a Comment