A common usage of these exception handling in Spring is to use RestControllerAdivce to handle globally.

For some exceptions from 3rd party libraries, it can be converted to your custom exception firstly, then handle it with RestControllerAdvice.

Maybe some codes in this article are not ready for production. But you are welcome to raise an issue about it or submit a PR to resolve it.

Written by

Self-employed technical consultant, solution architect and full-stack developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store