Closed marceloverdijk closed 6 years ago
Yes, you are right, is much better to standarize both of them in the same way. I just tried to show different ways of returning data. I personally think that the second approach is much better as it gives you more flexibility when returning data, I used it in the second case for returning different status codes.
Yes I agree the second approach is much more flexible.
Why is
https://github.com/javserlah/qforce/blob/4f75e51011e43ba3d84e3c04ad4fe240e200952d/src/main/java/nl/qnh/qforce/controller/QForceController.java#L31
returning a
List<Person>
.And
https://github.com/javserlah/qforce/blob/4f75e51011e43ba3d84e3c04ad4fe240e200952d/src/main/java/nl/qnh/qforce/controller/QForceController.java#L43
returning
ResponseEntity<Person>
.What is rationale to use two different approaches? One returning normal Java objects and the other one using
ResponseEntity
. Don't you think it would be better for consistency to use theResponseEntity
in both methods?