How to get controller method name in Spring Interceptor preHandle method?

Don't know about the Handler interceptor, but you could try to use Aspects and create a general interceptor for all your controller methods.

Don't know about the Handler interceptor, but you could try to use Aspects and create a general interceptor for all your controller methods. Using aspects, it would be easy to access your joinpoint method name. You can inject the request object inside your aspect or use: HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.

GetRequestAttributes()).getRequest(); To retrieve it from your advice method. For instance: @Around("execution (* com.yourpackages.controllers. *.

*(..)) && @annotation(org.springframework.web.bind.annotation. RequestMapping)") public Object doSomething(ProceedingJoinPoint pjp){ pjp.getSignature(). GetDeclaringType().getName(); }.

Thanks Bob, but I want to try first Handler Interceptor , if it is not helpful. Then I can decide to implement Aspect, – Ketan Dec 6 at 6:02 Yes Bob, finally I have replaced Handler Interceptor by Aspect – Ketan 2 days ago.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions