JBoss.org Community Documentation
<bind pointcut="execution(void Foo->bar())"> <interceptor-ref name="org.jboss.MyInterceptor/> <before name="beforeAdvice" aspect="org.jboss.MyAspect"/> <around name="aroundAdvice" aspect="org.jboss.MyAspect"/> <after name="afterAdvice" aspect="org.jboss.MyAspect"/> <throwing name="throwingAdvice" aspect="org.jboss.MyAspect"/> <finally name="finallyAdvice" aspect="org.jboss.MyAspect"/> <advice name="trace" aspect="org.jboss.MyAspect"/> </bind>
In the above example, the MyInterceptor
interceptor and several advice methods
of the MyAspect
class will be executed when the Foo.bar
method is invoked.
bind
tag is used to bind an advice of an aspect, or an interceptor to a specific joinpoint.
The
pointcut
attribute is required and at least an advice or interceptor-ref definition.
The
interceptor-ref
tag must reference an already existing
interceptor
XML
definition. The name attribute should be the name of the interceptor you are referencing.
All these tags take a
name
attribute that should map to an advice of the specified type within
the aspect class. The aspect
attribute should be the name of the aspect definition.
The same as the previous, except for the fact that doesn't specify the type of the advice. This
tag selects the default advice type, around, and is hence equivalent to the tag around
.