AOP not working for Controllers
Hi all,
I am newbie to AOP, and i want to have around advice for methods in controller. My interceptor method is not invoked for controllers, however, it works for other packages. Please let me know if I am doing something wrong.
This is my controller:
Code:
@Controller
public class HomeController {
@RequestMapping("/home.htm")
public String redirect(HttpServletRequest request) {
return "home";
}
}
Code:
@Aspect
public class LoggingInterceptor {
@Around("execution(* com.somepack.controller..*.*(..))")
public Object invokeMethod(ProceedingJoinPoint pjp) throws Throwable {
...
o = pjp.proceed();
...
return o;
}
}
And configuration as:
Code:
<bean id=" loggingInterceptor" class="com.somepack.util.LoggingInterceptor" />
<aop:aspectj-autoproxy>
<aop:include name="loggingInterceptor" />
</aop:aspectj-autoproxy>
Interceptor method is not invoked for "redirect" method of controller.
Please let me know if I am doing something wrong.