2.0.0之前使用:
@Autowired private ErrorAttributes errorAttributes; private Map<String, Object> getErrorAttributes(HttpServletRequest request, boolean includeStackTrace) { RequestAttributes requestAttributes = new ServletRequestAttributes(request); return this.errorAttributes.getErrorAttributes(requestAttributes, includeStackTrace); }
后续版本使用:
@Autowired private ErrorAttributes errorAttributes;
private Map<String, Object> getErrorAttributes(HttpServletRequest request, boolean includeStackTrace) { ServletWebRequest servletWebRequest = new ServletWebRequest(request); return this.errorAttributes.getErrorAttributes(servletWebRequest, includeStackTrace);}
原文地址:https://www.cnblogs.com/kingsonfu/p/10386376.html
时间: 2024-10-08 19:32:34