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

原文地址:

https://stackoverflow.com/questions/47756736/migrating-responsebody-to-responseentity

添加评论