DefaultErrorAttributes 继承ErrorAttributes重写getErrorAttributes 自定义异常信息
作者:互联网
@Component
public class Error extends DefaultErrorAttributes{
@Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
Map<String,Object> map =super.getErrorAttributes(webRequest, options);
map.put("dss","dss");
return map;
}
}
{ "timestamp": "2022-09-12T22:17:21.435+00:00", "status": 404, "error": "Not Found", "message": "No message available", "path": "/111222111111", "dss": "dss" }
标签:map,自定义,DefaultErrorAttributes,Map,dss,webRequest,getErrorAttributes,message 来源: https://www.cnblogs.com/dzs894330350/p/16687906.html