I don't know how to do it in an XML, but it's easy enough to do it in the aspects themselves, as pointcuts can be combined using boolean operators.
Traditional aspectj syntax:
pointcut whatIDontWantToMatch() : within(SomeClass+) || execution(* @SomeAnnotation *.*(..));
pointcut whatIWantToMatch() : execution(* some.pattern.here.*(..));
pointcut allIWantToMatch() : whatIWantToMatch() && ! whatIDontWantToMatch();
@AspectJ syntax:
@Pointcut("within(SomeClass+) || execution(* @SomeAnnotation *.*(..))")
public void whatIDontWantToMatch(){}
@Pointcut("execution(* some.pattern.here.*(..))")
public void whatIWantToMatch(){}
@Pointcut("whatIWantToMatch() && ! whatIDontWantToMatch()")
public void allIWantToMatch(){}
These are of course just samples. whatIDontWantToMatch()
could also be composed of several pointcuts etc.