Results 1 to 2 of 2

Thread: Question about Pointcut expression

  1. #1

    Default Question about Pointcut expression

    Please review the following classes:

    The pointcut below are too generic and I was expecting an infinite recursively loop when triggered. But to my surprise it didn't happen when I ran it.
    Why beforeTraced() and afterTraced() do not run into infinite recursively loops when triggered??

    Code:
    package com.simple.aspect.log;
    @Aspect
    public class LogManagerAspect
    {
            private Log log = LogFactory.getLog(getClass());
    
            @Before("execution(* com.simple..*.*(..))")
            public void beforeTraced(JoinPoint pjp)
            {
                    Signature sig = pjp.getSignature();
    
                    if (sig != null)
                            log.info("Entering [" + sig.toShortString() + "]");
            }
    
            @After("execution(* com.simple..*.*(..))")
            public void afterTraced(JoinPoint pjp)
            {
                    Signature sig = pjp.getSignature();
    
                    if (sig != null)
                            log.info("Leaving [" + sig.toShortString() + "]");
            }
    }
    Last edited by zollen; Jan 23rd, 2010 at 10:23 PM.

  2. #2

    Default

    According to the AspectJ in Action, 2nd Edition. The standard method invocation is not the same as "aspect" invocation. Both beforeTraced() and afterTraced() methods do not consider as regular methods, and therefore should not trigger the aspect. This is certainly different from what I read from the online spring reference pages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •