Springmvc
hander.getclass
class org.springframework.web.method.HandlerMethod
HandlerMethod.class
class org.springframework.messaging.handler.HandlerMethod
执行以下转换,报异常。
HandlerMethod method = (HandlerMethod) handler;
让 Interceptor 继承 HandlerInterceptorAdapter,不要继承HandlerInterceptor,即可解决。
if(HandlerMethod.class.equals(handler.getClass())){
HandlerMethod method = (HandlerMethod) handler;
Object controller = method.getBean();
}