Let's see a proposal of a common centralized way of handling REST operations exceptions for returning a pre-defined JSON document for them.
For Spring Boot >= 3
https://sites.google.com/site/pawneecity/sprint-boot/error-handling-rest-spring-boot/error-handling-sb3_1
For Spring Boot < 3
https://sites.google.com/site/pawneecity/sprint-boot/error-handling-rest-spring-boot/error-handling-sb3