package com.koobietech.eas.config; import com.koobietech.eas.common.result.JsonResult; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; @RestControllerAdvice public class ExceptionAdvice { @ResponseBody @ResponseStatus(HttpStatus.OK) @ExceptionHandler(Exception.class) public JsonResult exceptionHandler(Exception e){ e.printStackTrace(); return JsonResult.fail(e.getMessage()); } }