Instrumenting classloader to transform classes before being instantiated
Using Spring 3.1+
Is it possible to get at the Application context loader's classloader to transform a Class definition? Seen the weaving instrumentation stuff but haven't found a solid example online. Not sure how Spring handles class loading but assuming the application context is a "common" shareholder for classes in the classpath and any child classloader (made for whatever reasons) has the App context as it's parent.
What I want to do is intercept the registration of or reload certain classes to add a field with a specific annotation.
Looks like the @EnableLoadTimeWeaving allows for setting up a private LoadTimeWeavingConfigurer. Just not sure what to use. Testing is done in Eclipse but the target environment will not be forced into a particular container (i.e. Weblogic, Tomcat and so forth). Would like to not use the -javaagent to jack in a LoadTimeWeaver which is what I assume the EnableLoadTimeWeaving does? Should be able to add a transformer that switches out my bytecode.
Ideas?