constroller exception unified handling class
The result is the processing result that you want to return, and the purpose of the blog is to illustrate the use of @controllerAdvice extensions in conjunction with exception classes
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class BaseExceptionHander {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
e.printStackTrace();
return new Result();
}
}