Class ApiExceptionHandler
- java.lang.Object
-
- org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
- com.alon.spring.crud.api.exceptionhandler.ApiExceptionHandler
-
@ControllerAdvice public class ApiExceptionHandler extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
-
Constructor Summary
Constructors Constructor Description ApiExceptionHandler(org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntityhandleBeanValidation(BeanValidationException ex, org.springframework.web.context.request.WebRequest request)protected org.springframework.http.ResponseEntityhandleBindException(org.springframework.validation.BindException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleCrudException(CrudException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleDataIntegrityException(DataIntegrityException ex, org.springframework.web.context.request.WebRequest request)protected org.springframework.http.ResponseEntityhandleExceptionInternal(java.lang.Exception ex, java.lang.Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)protected org.springframework.http.ResponseEntityhandleHttpMessageNotReadable(org.springframework.http.converter.HttpMessageNotReadableException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleIllegalArgumentException(java.lang.IllegalArgumentException ex, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleInvalidFormatException(com.fasterxml.jackson.databind.exc.InvalidFormatException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleMethodArgumentNotValid(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleMethodArgumentTypeMismatchException(org.springframework.web.method.annotation.MethodArgumentTypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)protected org.springframework.http.ResponseEntityhandleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleNotFoundException(NotFoundException ex, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandlePropertyBindingException(com.fasterxml.jackson.databind.exc.PropertyBindingException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandlePropertyReferenceException(org.springframework.data.mapping.PropertyReferenceException ex, org.springframework.http.HttpHeaders headers, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleResponseStatusException(org.springframework.web.server.ResponseStatusException ex, org.springframework.web.context.request.WebRequest request)protected org.springframework.http.ResponseEntityhandleTypeMismatch(org.springframework.beans.TypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)org.springframework.http.ResponseEntityhandleUncaught(java.lang.Exception ex, org.springframework.web.context.request.WebRequest request)-
Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
handleAsyncRequestTimeoutException, handleConversionNotSupported, handleException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleServletRequestBindingException
-
-
-
-
Method Detail
-
handleUncaught
@ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity handleUncaught(java.lang.Exception ex, org.springframework.web.context.request.WebRequest request)
-
handleCrudException
@ExceptionHandler(CrudException.class) public org.springframework.http.ResponseEntity handleCrudException(CrudException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)
-
handlePropertyReferenceException
@ExceptionHandler(org.springframework.data.mapping.PropertyReferenceException.class) public org.springframework.http.ResponseEntity handlePropertyReferenceException(org.springframework.data.mapping.PropertyReferenceException ex, org.springframework.http.HttpHeaders headers, org.springframework.web.context.request.WebRequest request)
-
handleHttpMessageNotReadable
protected org.springframework.http.ResponseEntity handleHttpMessageNotReadable(org.springframework.http.converter.HttpMessageNotReadableException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleHttpMessageNotReadablein classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleInvalidFormatException
@ExceptionHandler(com.fasterxml.jackson.databind.exc.InvalidFormatException.class) public org.springframework.http.ResponseEntity handleInvalidFormatException(com.fasterxml.jackson.databind.exc.InvalidFormatException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)
-
handlePropertyBindingException
@ExceptionHandler(com.fasterxml.jackson.databind.exc.PropertyBindingException.class) public org.springframework.http.ResponseEntity handlePropertyBindingException(com.fasterxml.jackson.databind.exc.PropertyBindingException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)
-
handleTypeMismatch
protected org.springframework.http.ResponseEntity handleTypeMismatch(org.springframework.beans.TypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleTypeMismatchin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleMethodArgumentTypeMismatchException
public org.springframework.http.ResponseEntity handleMethodArgumentTypeMismatchException(org.springframework.web.method.annotation.MethodArgumentTypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)
-
handleBindException
protected org.springframework.http.ResponseEntity handleBindException(org.springframework.validation.BindException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleBindExceptionin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleMethodArgumentNotValid
public org.springframework.http.ResponseEntity handleMethodArgumentNotValid(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleMethodArgumentNotValidin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleNoHandlerFoundException
protected org.springframework.http.ResponseEntity handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleNoHandlerFoundExceptionin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleBeanValidation
@ExceptionHandler(BeanValidationException.class) public org.springframework.http.ResponseEntity handleBeanValidation(BeanValidationException ex, org.springframework.web.context.request.WebRequest request)
-
handleNotFoundException
@ExceptionHandler(NotFoundException.class) public org.springframework.http.ResponseEntity handleNotFoundException(NotFoundException ex, org.springframework.web.context.request.WebRequest request)
-
handleDataIntegrityException
@ExceptionHandler(DataIntegrityException.class) public org.springframework.http.ResponseEntity handleDataIntegrityException(DataIntegrityException ex, org.springframework.web.context.request.WebRequest request)
-
handleIllegalArgumentException
@ExceptionHandler(java.lang.IllegalArgumentException.class) public org.springframework.http.ResponseEntity handleIllegalArgumentException(java.lang.IllegalArgumentException ex, org.springframework.web.context.request.WebRequest request)
-
handleResponseStatusException
@ExceptionHandler(org.springframework.web.server.ResponseStatusException.class) public org.springframework.http.ResponseEntity handleResponseStatusException(org.springframework.web.server.ResponseStatusException ex, org.springframework.web.context.request.WebRequest request)
-
handleExceptionInternal
protected org.springframework.http.ResponseEntity handleExceptionInternal(java.lang.Exception ex, java.lang.Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)- Overrides:
handleExceptionInternalin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
-