Creating Dynamic Concrete Aspects

This section describes how to instrument classes and methods that are not covered by plugins. You create dynamic concrete aspects by editing the insight/collection-plugins/custom-aop/META-INF/aop.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
    <aspects>
       <concrete-aspect name="foo.bar.BazAspect" extends="com.springsource.insight.collection.method.custom.CustomConcretizedOperationCollectionAspect">
           <pointcut name="collectionPoint" expression="execution(* foo.bar.Baz.mySuperDuperMethod(..))" />
       </concrete-aspect>
    </aspects>
</aspectj>

The following examples illustrate different definitions of the expression and the effect achieved by each.

Example 1

Monitor all public methods from any class that is annotated with @MyClassAnnotation:

execution(* (@foo.bar.MyClassAnnotation *).*(..))

Example 2

Monitor all public methods from any class ending in Impl that resides in the foo.bar package or any of its sub-packages:

execution(* foo.bar..*Impl.*(..))

Example 3

Monitor all public methods that are annotated with @MyMethodAnnotation from any class:

execution(@foo.bar.MyMethodAnnotation * *(..))

Example 4

Monitor all public login methods that accept two String parameters and that are implemented by MyClass or any class that extends it:

execution(* foo.bar.MyClass+.login(java.lang.String,java.lang.String))

Notes: