I have this PointCut
@Pointcut("execution(@com.foo.bar.aspect.annotation.MyAnnotation* * (..))"
+ "&& @annotation(annot)")
public void anyFoo(MyAnnotation annot)
{
}
MyAnnotation
looks like this:
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation
{
boolean isFoo();
String name;
}
Let's say I annotate a method with this annotation with isFoo set to true
@MyAnnotation(isFoo = true, name = "hello")
public void doThis()
{
System.out.println("Hello, World");
}
How do I write my pointcut so that it matches only method annotated with MyAnnotaion
AND isFoo = true
?
I tried this but it doesn't seem to work
@Pointcut("execution(@com.foo.bar.aspect.annotation.MyAnnotation(isFoo = true, *) * * (..))"
+ "&& @annotation(annot)")
public void anyFoo(MyAnnotation annot)
{
}