0

I have written the following pointcut but it is giving the run time error (Exception in thread "main" java.lang.StackOverflowError)

pointcut traceAttribs():(get(* *));

Himanshu dua
  • 2,496
  • 1
  • 20
  • 27
  • Without some more information on how that pointcut is used, what your code looks like etc., you won't get any answers. A StackOverflowError isn't very likely to come from a pointcut like that, so your problem might be something else. – sheltem Feb 17 '14 at 13:15

1 Answers1

0

What I understand from your question is that you need to create an aspect that knows your methods argument in real time.

There is a useful simple examples in Mkyong's page and probably your need is on point 8.

If you want to get a method name and arguments in your aspect you could write something like this:

@Aspect
public class LoggingAspect {

   @Around("execution(* com.your.package.YourClass.yourMethodAround(..))")
   public void logAround(ProceedingJoinPoint joinPoint) throws Throwable {

    System.out.println("Your method: " + joinPoint.getSignature().getName());
    System.out.println("and method arguments: " + Arrays.toString(joinPoint.getArgs()));

    System.out.println("Your method will be executed. ");
    joinPoint.proceed(); //continue on the intercepted method
    System.out.println("Ended execution");

   }
}

Hope to help

Federico Piazza
  • 30,085
  • 15
  • 87
  • 123