Features

AspectWerkz supports the following features

This is a very incomplete list, see the documentation for all features.

  • Runtime and load time bytecode modification (weaving). Hooks in and transforms classes loaded by any class loader except the bootstrap class loader. Which basically means that you can easily transform any (legacy) application or external library apart from rt.jar both at runtime and compile time.

    JSR-163 JVMTI is supported for Java 1.5 usage as well.


  • The join point model supports: method execution and call, constructor execution and call, field access, field modification, catch handlers, cflow, within and withincode, hasmethod and hasfield. All advice works with all join points.


  • Annotation support: Matching on annotations (both JavaDoc and JSR-175). Supports user-defined annotations, retrieval of annotations. Both JavaDoc and JSR-175 annotations are accessed through one single API and both schemes are strongly typed.


  • Support for deploying several aop.xml Aspect defintion/deployment files alongside deployed application ( WEB-INF/aop.xml, META-INF/aop.xml) and have them following the classloader hierarchy.


  • Introductions/Inter type declarations (also called Mixins), i.e. the possibility to add interfaces and implementations to existing classes.


  • Annotation definition. Define your aspects using runtime annotations (ready for JSR-175).


  • XML definition. Define your aspects using XML. The XML definition can also be used to refine, override and resolve the annotation definition.


  • Pluggable aspect manager that can make it work seamlessly with IoC frameworks like Spring or PicoContainer.


  • Four different deployment models (scope) for both advices and introductions: perJVM (singleton), perClass, perInstance and perThread.


  • Hot deployment, advices and introductions can be dynamically deployed, undeployed or rearranged (without reloading or retransforming the target classes).


  • Very high-performant. An advice adds an overhead of only ~0.000009 ms/call (on my Intel Pentium 4 Mobile 1.6 Mhz). Uses JIT compilation.


  • Fine-grained pattern language for selecting the join points.


  • Highly orthogonal underlying model. All advice works with all join points and pointcut composition supports mixing all kinds of pointcuts.


  • "Offline" transformation (can be used as a post-processor).


  • Aspects, advices and introductions are written in plain old Java code. I.e. no new language to learn, no new compilation phases, no need to tell your manager ;-). Will work seamlessly in any IDE, debugger, refactoring tool and test framework.


  • The target classes can be regular POJOs (Plain Old Java Objects), i.e. do not need to have an interface.


  • Support for passing parameters to the advices through the definition and for defining advice stacks which can be reused.


  • Meta-data additions to classes. Possibilities to add meta-data to all loaded classes.


  • Simple usage and configuration.