How to get method information at Interceptor preHandle method in spring boot 1.3 -
@override public boolean prehandle(httpservletrequest request, httpservletresponse response, object handler) throws exception { if (this.logger.isdebugenabled()) { this.logger.debug(">>> handler: " + handler); } handlermethod handlermethod = (handlermethod) handler; login login = handlermethod.getmethod().getannotation(login.class); }
i had above interceptor code in spring 3.x works. use code in controller having @crossorigin
, @requestmapping
method @ spring boot 1.3. below error occured.
how method information @ interceptor prehandle
method in spring boot 1.3?
caused by: java.lang.classcastexception: org.springframework.web.servlet.handler.abstracthandlermapping$preflighthandler cannot cast org.springframework.web.method.handlermethod
is added portion process request cors added after 4.2 spring again process "interceptor". can add code check whether "handler" of object type "handlermethod" type.
e.g.
if (handler instanceof handlermethod) {...}
Comments
Post a Comment