I want to know how can I handle internal server error type exceptions in Spring Data Rest such as JPA exceptions etc. due to a malformed request or a database crash. I did some
You can do it like this:
@ControllerAdvice(basePackageClasses = RepositoryRestExceptionHandler.class) public class GenericExceptionHandler { @ExceptionHandler ResponseEntity handle(Exception e) { return new ResponseEntity("Some message", new HttpHeaders(), HttpStatus.BAD_REQUEST); } }