https://www.toptal.com/java/spring-boot-rest-api-error-handling - reading this article it's considered best practice to offload exception handling to a global error handling class annotated with @Controlleradvice that spring uses to handle all exceptions thrown by service methods.
The article suggests controller methods should only return 'success' responses and allow all error responses (404, 500 etc.) to be handled by the global error class.
https://www.toptal.com/java/spring-boot-rest-api-error-handling - reading this article it's considered best practice to offload exception handling to a global error handling class annotated with @Controlleradvice that spring uses to handle all exceptions thrown by service methods.
The article suggests controller methods should only return 'success' responses and allow all error responses (404, 500 etc.) to be handled by the global error class.