Announcement Announcement Module
Collapse
No announcement yet.
Question about Pointcut expression Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 11:23 PM.

  • #2
    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.

    Comment

    Working...
    X