Created
April 13, 2016 21:48
-
-
Save fagossa/95ab5f0edcdc26d7e946dfb4a85efbcb to your computer and use it in GitHub Desktop.
Springboot - Mapping exceptions to HttpStatus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RequestMapping("/employee") | |
| @Controller | |
| public class EmployeeSearchController { | |
| // some other code generating exceptions... | |
| @ResponseStatus(HttpStatus.BAD_REQUEST) | |
| @ExceptionHandler(value = {EmptyResultDataAccessException.class, EntityNotFoundException.class}) | |
| public void handleNotFound() {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment