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'
无法追踪任何有关原因的读物。
答案 0 :(得分:1)
添加以下导入:
import org.springframework.web.method.HandlerMethod;