I have declared the following aspect in aop.xml
ControllerStatsAspect.java
aop.xmlCode:@Aspect public class ControllerStatsAspect { private Log log = LogFactory.getLog(getClass()); @DeclareMixin("com.simple.web.*Controller") public Statsable statsableMixin(Object statsObj) { log.info("STATS: Mixin: " + statsObj); return new StatsableDefaultImpl(statsObj); } @Before("execution(public * com.simple.web.*Controller.*(..)) && this(Statsable)") public void increment(Statsable statsObj) { log.info("STATS: increment: " + statsObj); } @After("execution(public * com.simple.web.*Controller.*(..)) && this(Statsable)") public void report(Statsable statsObj) { log.info("STATS: reports: " + statsObj); } }
I can see the log messages generated by ControllerStatsAspect.increment() and ControllerStatsAspect.reports() and both with null statsObj. But I never see any log message generated by the statsableMixin() method. I assume that explain why increment() and reports() log messages have a null statsObj object. I have two Controller classes under the com/simple/web folder and the web application is working without throwing any exceptions.Code:<aspectj> <aspects> <!-- declare three existing aspects to the weaver --> <aspect name="com.simple.aspect.stats.ControllerStatsAspect"/> </aspects> <weaver options="-verbose"> <include within="com.simple..*"/> <!-- Do not weave types within the "CGLIB" generated package --> <exclude within="*..*EnhancerByCGLIB*..*"/> <exclude within="*..*.*$$EnhancerByCGLIB$$*"/> <exclude within="*..*.*$$FastClassByCGLIB$$*"/> </weaver> </aspectj>
Any idea why method statsableMixin() never get called?


Reply With Quote
