org.springframework.boot.autoconfigure.web.ErrorAttributes#org.springframework.boot.autoconfigure.web.DefaultErrorAttributes源码实例Demo

下面列出了org.springframework.boot.autoconfigure.web.ErrorAttributes#org.springframework.boot.autoconfigure.web.DefaultErrorAttributes 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: searchbox-core   文件: SearchBoxConfiguration.java
@Bean
public ErrorAttributes customizeErrorResponseAttributes() {
    
	return new DefaultErrorAttributes(){
    	@Override
        public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
            Map<String, Object> errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
            errorAttributes.remove("timestamp");
            errorAttributes.remove("exception");
            return errorAttributes;
        }
    };
    
}
 
@Bean
ErrorAttributes errorAttributes() {
    return new DefaultErrorAttributes();
}