
Originally Posted by
johras
Code:
@Aspect
public void MyClass {
@AnnotationMatchingPointcut(MyCustomAdvice.class)
public void method() {}
over:
Code:
@Aspect
public void MyClass {
@Pointcut("@annotation(MyCustomAdvice")
public void method() {}
This thread has caught my attention because I have written a couple of aspects that are based on custom annotations. I am intrigued by @AnnotationMatchingPointcut. Unfortunately, AnnotationMatchingPointcut is NOT an annotation. You can't use it that way. I just tried, out of freak hope that it would work, and Eclipse is puking all over that. It appears you can res it up inside an appContext.xml file, but I don't see how to plug it in to @AspectJ.
So far, I have
Code:
@Around("execution(@my.package.app.annotations.Timed * *(..))")
public Object calculatePerformance(ProceedingJoinPoint jp) throws Throwable {
And yes, I have a unit test to make sure my aspect works and that my point cut works.