You can declare predefined lists of interceptors can be referenced in any bindings.
<stack name="stuff"> <interceptor class="SimpleInterceptor1"/> <interceptor class="SimpleInterceptor2"/> <interceptor class="SimpleInterceptor3"/> </stack> <bind pointcut="execution(* POJO->*(..))"> <stack-ref name="stuff"/> </bind>
The <stack> element just defines a set of interceptors/advices. You can reference it from within a binding via a <stack-ref> element.
THIS EXAMPLE REQUIRES JDK 5!! For other options, please look at the non-annotated examples guide To compile and run:
$ run.aopc.50
It will javac the files and then run the AOPC precompiler to manipulate the bytecode, then finally run the example. The output should be similar to this:
_run.aopc.50: [java] SimpleInterceptor1 [java] SimpleInterceptor2 [java] SimpleInterceptor3 [java] someMethod()