Spring Boot版本 1.5
@ControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler{ @ExceptionHandler(value = Exception.class)
@ResponseBody
public String jsonHandler(HttpServletRequest request, Exception e){
logger.error("全局异常处理: ", e);
return ResponseUtil.getResponse();
}
}