使用较高版本的SpringBoot会出现报错:boolean无法转换为org.springframework.boot.web.error.ErrorAttributeOptions
Abbert-Ekko opened this issue · 2 comments
Abbert-Ekko commented
使用较高版本的SpringBoot会出现报错:boolean无法转换为org.springframework.boot.web.error.ErrorAttributeOptions
ZHENFENG13 commented
需要改一下代码吧,回头我弄一下2.6.x版本的,等我有空。
HankMai commented
作者更新之前,可以试一下改成这个临时代码
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
Map<String, Object> body = getErrorAttributes(request, ErrorAttributeOptions.defaults());
HttpStatus status = getStatus(request);
return new ResponseEntity<Map<String, Object>>(body, status);
}
protected Map<String, Object> getErrorAttributes(HttpServletRequest request, ErrorAttributeOptions options) {
WebRequest webRequest = new ServletWebRequest(request);
return this.errorAttributes.getErrorAttributes(webRequest, options);
}