user721264
user721264

Reputation: 487

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) {
            //..
        }
    }
}

Gives me: 'HandlerMethod cannot be resolved to a type'

Haven't been able to track down any read up as to why.

Upvotes: 0

Views: 1866

Answers (1)

Joe F
Joe F

Reputation: 4252

Add the following import:

import org.springframework.web.method.HandlerMethod;

Upvotes: 1

Related Questions