org.springframework.web.method.HandlerMethod 与 org.springframework.messaging.handler.HandlerMethod 转换失败

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();


}

posted @ 2017-10-23 11:18  青羽  阅读(1015)  评论(0编辑  收藏  举报