Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

post load time weaving in java

Post-compile: weaving is also sometimes called binary weaving, and is used to weave existing class files and JAR files. As with compile-time weaving, the aspects used for weaving may be in source or binary form, and may themselves be woven by aspects.
Load-time: weaving is simply binary weaving deferred until the point that a classloader loads a class file and defines the class to the JVM. To support this, one or more "weaving class loaders", either provided explicitly by the run-time
I was reading as above.
I have not understood clearly difference bewteen post compile,load time weaving what are advantages, disadvantages, practical uses.
please advise
Any links resources ideas highly appreciated. Thanks in advance
Avatar of girionis
girionis
Flag of Greece image

If you use load-time weaving the loading of your class will be a bit slower, that's the only difference with the post-compile weaving.
Avatar of gudii9

ASKER

I never used this weaving. What is practical use of these weaving. Please advise
Weaving is a technique that is used to enhance the functionality of a Java class. You do this by injecting bytecode* into a java class that manipulates a class file and adds more features to the class. For example you can weave JPA entities to add optimisation code that the programmer hasn't thought of.

Bytecode weaving can be done either post-compile (when your source files are compiled and have become a java class, then you weave the bytecode)  or during load time (when your class is loaded).

* There is also source code weaving.
Avatar of gudii9

ASKER

any practical examples, links on this to try out. please advise
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial