AOP Newbie question, so your patience appreciated...
I want to trace my Controllers in my web application. So I created the beginings of my Aspect class.
com.villaruz.tipunan.web is the package where my controllers are.
On my <webAppName>-servlet.xml file I let the component be scanned.Code:package com.villaruz.tipunan.utilities; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component; @Component @Aspect public class TraceLoggerAspect{ /** Logger for this class and subclasses */ protected final Log logger = LogFactory.getLog(getClass()); @Pointcut("execution(* com.villaruz.tipunan.web..*.*(..))") public void trace(){ logger.info("~*~*~* In TraceLogger.trace() ~*~*~*"); } @Before("trace()") public void log(JoinPoint joinPoint){ logger.info("~*~*~* In TraceLogger.log() ~*~*~* Before calling " + joinPoint.getSignature().getName() + " with argument " + joinPoint.getArgs()[0]); } }
On my application.xml file I have:Code:<context:component-scan base-package="com.villaruz.tipunan.utilities"/>
On application startup, I do see the bean created.Code:<aop:aspectj-autoproxy/>
However, upon execution of any of my Controller, I do not see the Aspect intercepting.
Any help is appreciated.


Reply With Quote