For some reason, my pointcut is not triggered. Note: I am using spring-style aspects, not AspectJ style.
XML snippet
<bean id="authenticationAspect" class="ssel.banking.security.AuthenticationAspect" />
<aop:config>
<aop:aspect ref="authenticationAspect">
<aop:pointcut id="interceptControllerInvocation"
expression="execution(* org.springframework.web.servlet.mvc.Controller+.handleRequestInternal(javax.servlet.http.HttpServletRequest, ..))
and args(request, ..)
and target(controller)"/>
<aop:around pointcut-ref="interceptControllerInvocation"
method="authenticationAdvice"/>
</aop:aspect>
</aop:config>
Class defined by my bean
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class AuthenticationAspect {
public ModelAndView authenticationAdvice(ProceedingJoinPoint pjp, HttpServletRequest request, Controller controller) throws Throwable{
String URL = request.getRequestURL().toString();
String viewName = URL.substring(0, URL.length() - 4);
System.out.println(viewName);
return (ModelAndView) pjp.proceed();
}
}
Am I missing something?
handleRequestInternalis not being called across a bean boundaries (i.e. it is being called from another method in the bean likehandleRequestit won't be proxied because it is a reentrant call. - mkobit