Hi,
started down the road to using AOP and have something but stuck on a couple of issues:
1. I cannot seem to change the pointcut and have it work.
2. I can get the method name but not sure how to get the args in a type safe manner (i want to log them in the db).
Here's my current config (used the ref guide):
I created a SystemArchitecture class to hold all the pointcuts:
I added the lines to my service layer xml config file (I have a set of them - could that be the problem?):Code:// modules // =========== @Pointcut("within(com.acme.tsfi.service..*)") public void inServiceLayer() { } @Pointcut("within(com.acme.tsfi.web..*)") public void inWebLayer() { }
and here my aspect code:Code:<!-- custom aspects configured here --> <aop:aspectj-autoproxy /> <bean id="profilerAspect" class="com.acme.tsfi.aop.ProfilerAspect"/>
Now the above WORKS. If i change the annotation to this however:Code:@Around("com.amex.ifst.aop.SystemArchitecture.inServiceLayer()") public Object doServiceLevelProfiling(ProceedingJoinPoint pjp) throws Throwable { _logger.debug(" SERVICE LAYER: Executing: {}", pjp.toString()); // start stopwatch StopWatch clock = new StopWatch(); clock.start("Service Task"); Object retVal = pjp.proceed(); // stop stopwatch clock.stop(); _logger.debug(" SERVICE LAYER: Execution of {} completed in {}ms",pjp.toString(),clock.getTotalTimeMillis()); return retVal; }
nothing happens. Any idea why? Is it because my web beans are in another xml file and so not visible?Code:@Around("com.amex.ifst.aop.SystemArchitecture.inWebLayer()")
I'm also not sure how to get the args that were passed in to the methods.
Cheers
R


Reply With Quote