如有关错误处理的文档所述,你可以提供自己的bean,该bean实施
ErrorAttributes以控制内容。
一个简单的方法是继承
DefaultErrorAttributes。例如:
@Beanpublic ErrorAttributes errorAttributes() { return new DefaultErrorAttributes() { @Override public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) { Map<String, Object> errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace); // Customize the default entries in errorAttributes to suit your needs return errorAttributes; } };}


