Skip to content

Instantly share code, notes, and snippets.

@fagossa
Created April 13, 2016 21:48
Show Gist options
  • Save fagossa/95ab5f0edcdc26d7e946dfb4a85efbcb to your computer and use it in GitHub Desktop.
Save fagossa/95ab5f0edcdc26d7e946dfb4a85efbcb to your computer and use it in GitHub Desktop.
Springboot - Mapping exceptions to HttpStatus
@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