Dynamic Agent
Jdk1.3 only the introduction of dynamic agent mechanism, can be run again, for the corresponding interface (must have interface) dynamically generated corresponding proxy object
Based on the above problems, we can encapsulate the crosscutting concern logic into the invocationhandler of dynamic agents.
Performance is definitely better than static class execution, after all, this is the use of reflection during run time
Dynamic byte-code enhancement Technology
Execute a class file that dynamically builds bytecode while the program is running, using cglib directly
However, if a class that needs to be extended and an instance method in a class are declared final, then it is not possible to subclass the extension.
When Spring AOP cannot use the dynamic agent mechanism to extend the AOP function, it uses the dynamic bytecode enhancement of the Cglib library to realize the function extension of AOP.
Java code Generation
For example, the EJB will generate the corresponding Java code for the corresponding function module class according to the information provided by the descriptor according to the weaving information provided by the deployment descriptor file, and then compile the Java code from the deployment tool or the deployment interface to generate the corresponding Java class.
Custom Class Loaders
Class is loaded into the Java virtual machine by the appropriate ClassLoader (Classloader) before it can run.
We can complete the cross-cutting logic to the system by customizing the ClassLoader, and the custom ClassLoader can add the crosscutting to the existing logic of the system module class while loading the class file by reading the rules and necessary information required by the external file. Then give the modified class to the Java virtual machine to run.
"Sping Revelation" 11, the implementation mechanism of AOP on the Java platform