Return ResponseEntity vs returning POJO

ResponseEntity<T> represents the entire HTTP response. Besides the body, its API allows you to set headers and a status code to the response.

Returning just a bean is fine but doesn’t give you much flexibility: In the future, if you need to add a header to the response or modify the status code, for example, you need to change the method return type.

For more details on return values, refer to the Spring MVC documentation.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)