1.错误页面直接定义在templates/error下面就行
5xx错误
状态码:[[${status}]]
错误提示:[[${error}]]
异常消息::[[${message}]]
时间戳::[[${timestamp}]]
2.配置全局异常
//异常通知,处理全局异常
@ControllerAdvice
public class ExceptionAdvice {
//算术异常,其他异常Exception.class
@ExceptionHandler(ArithmeticException.class)
public String arithmetic(Exception e){
System.out.println("出现异常:"+e.getMessage());
return "error/5xx";
}
}



