Class GlobalExceptionAdvice

java.lang.Object
com.feiniaojin.gracefulresponse.advice.GlobalExceptionAdvice
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@ControllerAdvice @Order(200) public class GlobalExceptionAdvice extends Object implements org.springframework.context.ApplicationContextAware
全局异常处理.
Since:
0.1
Version:
0.1
Author:
Yujie
  • Constructor Details

    • GlobalExceptionAdvice

      public GlobalExceptionAdvice()
  • Method Details

    • exceptionHandler

      @ExceptionHandler(java.lang.Throwable.class) @ResponseBody public Response exceptionHandler(Throwable throwable)
      异常处理逻辑.
      Parameters:
      throwable - 业务逻辑抛出的异常
      Returns:
      统一返回包装后的结果
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException