我的项目是在spring mvc上做的,我写了一个拦截器来拦截请求,我想从请求中获取参数,下面是我的代码:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HandlerMethod maControl = (HandlerMethod) handler;
Method pmrResolver = (Method) maControl.getMethod();
String methodName = pmrResolver.getName();
....
}
但现在它抛出了一个异常:
java.lang.ClassCastException: org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler cannot be cast to org.springframework.web.method.HandlerMethod
异常的原因是什么?