Class ApiRuntimeExceptionHandler


  • @ControllerAdvice
    @Order(2147483647)
    public class ApiRuntimeExceptionHandler
    extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
    Global exception handler for API, returning JSON instead of plain text. This advice can be overwritten at controller level as it has lowest precedence.
    Since:
    1.0
    Version:
    1.0
    Author:
    Karafra
    • Field Summary

      • Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<ApiRuntimeExceptionHandler.JsonErrorResponse> handleRuntimeException​(ApiRuntimeException ex, org.springframework.web.context.request.ServletWebRequest req)
      Method that handles runtime exceptions.
      • Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleExceptionInternal, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
    • Constructor Detail

      • ApiRuntimeExceptionHandler

        public ApiRuntimeExceptionHandler()