0
public class AnnotationInterceptor extends HandlerInterceptorAdapter implements InitializingBean {
 public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        HandlerMethod method = (HandlerMethod) handler;
        Api methodAnnotation = method.getMethodAnnotation(Api.class);

        if (methodAnnotation != null) {
            //..
        }
    }
}

给我:'HandlerMethod cannot be resolved to a type'

一直无法追踪任何关于原因的阅读。

4

1 回答 1

1

添加以下导入:

import org.springframework.web.method.HandlerMethod;
于 2013-05-31T16:10:30.920 回答