3. AspectJ Configuration

For AspectJ LTW a configuration file will automatically be loaded from META-INF/aop.xml. Multiple includes or excludes can be used to target weaving, and if you wanted to include all subpackages and not just a specific package the package name could be specified as org.springbyexample.aspectjLoadTimeWeaving..* (notice the double periods before the asterisk). In this example, the aspect specified contains the pointcut and advice being applied.

/META-INF/aop.xml
                
<!DOCTYPE aspectj PUBLIC
        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
    <weaver>
        <!-- only weave classes in this package -->
        <include within="org.springbyexample.aspectjLoadTimeWeaving.*" />
    </weaver>
    <aspects>
        <!-- use only this aspect for weaving -->
        <aspect name="org.springbyexample.aspectjLoadTimeWeaving.PerformanceAdvice" />
    </aspects>
</aspectj>