fixed: handler 可能为非HandlerMethod 类型的异常

This commit is contained in:
jacobs 2020-05-04 11:04:11 +08:00
parent 74055a5390
commit 19708ebeb6
1 changed files with 65 additions and 63 deletions

View File

@ -34,10 +34,12 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
// if json
boolean isJson = false;
HandlerMethod method = (HandlerMethod)handler;
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
if (responseBody != null) {
isJson = true;
if (handler instanceof HandlerMethod) {
HandlerMethod method = (HandlerMethod)handler;
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
if (responseBody != null) {
isJson = true;
}
}
// error result