Understanding weaving

Once we define a PointCut (identifies which methods needed to be advised) and advice (what needs to be done), the AOP framework needs to modify the code so that the advice is applied to all the methods that match the PointCut. This process is called weaving.

There are three kinds of weaving:

  • Compile-Time Weaving: The input is your source code, while the output is a compiled class with weaving.
  • Binary Weaving: This is done after the code is compiled. The input is compiled class files or, jar files, while the output is either compiled classes or jars with weaving.
  • Runtime Weaving: Weaving is done just before the class is loaded into JVM.

Compile-time weaving provides better performance than runtime weaving, but comes with greater complications since you would need an extra weaving step during compilation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset