繁体   English   中英

注释拦截器中HandlerMethod的问题

[英]Issues with HandlerMethod in annotation interceptor

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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM