Thursday, October 15, 2009

Spring Terminology: Weaving

Weaving is the process of applying Aspects to Targets to create Proxies. The aspects are woven into the target at the specified joinpoints. This process can happen at different stages of the Target's life
1. Compile Time: Aspects woven into targets when target class is compiled. This requires a special compiler though. Aspectj's weaving compiler weaves aspect this way.
2. Classload time: Aspects woven into targets when target class is loaded into the JVM. This requires a special class loader that enhances the target class's byte code before it is introduced to the application. Aspectj 5's load time weaving (LTW) support is based on this approach.
3. Runtime: Aspects woven into targets when target class is invoked. Typically an AOP container will generate a proxy object that will deliver the aspect functionality before or after delegating to the target object. This is how Spring AOP aspects are woven.

Source: My understanding from reading "Spring In Action"

No comments: