Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Circular advice precedence and same Advice class

How does one get rid the circular advice precedence error when the pointcut points to a single method, and the concrete-aspect comes from a single Advice class?

The error:
"error at myPath\ProfilingAbstractAspect.java::0 circular advice precedence: can't determine precedence between two or more pieces of advice that apply to the same join point"

The advice class:
@Aspect
public abstract class ProfilingAbstractAspect {
    @Pointcut
    public abstract void beforeScope();
    @Pointcut
    public abstract void afterScope();
    @Pointcut
    public abstract void aroundScope();

    @Before("beforeScope()")
    public void beginProfile(JoinPoint jp) {
    ...
    }
    @After("afterScope()")
    public void afterProfile() {
    ...
    }
    @Around("aroundScope()")
    public Object aroundProfile(ProceedingJoinPoint pjp) throws Throwable {
     ...
    }
}


The aop.xml definition of concrete aspects and join point:
    <aspects>
        <concrete-aspect name="myPath.ProfilingServlet"
           extends="myPath.ProfilingAbstractAspect">
<pointcut name="beforeScope" expression="execution(* myPath.Servlet.doService(..))"
              precedence="myPath.ProfilingAbstractAspect,*"/>
<pointcut name="afterScope" expression="execution(* myPath.Servlet.doService(..))"
              precedence="myPath.ProfilingAbstractAspect,*"/>
<pointcut name="aroundScope" expression="execution(* myPath.Servlet.doService(..))" precedence="myPath.ProfilingAbstractAspect,*"/> </concrete-aspect>
    </aspects>

--
Thanks, Dan


Back to the top