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'
尚未能够找到有关原因的任何阅读资料。
最佳答案
添加以下导入:
import org.springframework.web.method.HandlerMethod;