Class DefaultContextLoadTimeWeaver
- All Implemented Interfaces:
 Aware,BeanClassLoaderAware,DisposableBean,LoadTimeWeaver
LoadTimeWeaver bean for use in an application context,
 decorating an automatically detected internal LoadTimeWeaver.
 Typically registered for the default bean name "loadTimeWeaver";
 the most convenient way to achieve this is Spring's
 <context:load-time-weaver> XML tag or @EnableLoadTimeWeaving
 on a @Configuration class.
 
This class implements a runtime environment check for obtaining the
 appropriate weaver implementation, including
 Spring's VM agent and any ClassLoader
 supported by Spring's ReflectiveLoadTimeWeaver.
- Since:
 - 2.5
 - Author:
 - Juergen Hoeller, Ramnivas Laddad, Costin Leau
 - See Also:
 
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransformer(ClassFileTransformer transformer) Add aClassFileTransformerto be applied by thisLoadTimeWeaver.protected @Nullable LoadTimeWeavercreateServerSpecificLoadTimeWeaver(ClassLoader classLoader) voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.Return aClassLoaderthat supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers.Return a throwawayClassLoader, enabling classes to be loaded and inspected without affecting the parentClassLoader.voidsetBeanClassLoader(ClassLoader classLoader) Callback that supplies the beanclass loaderto a bean instance. 
- 
Field Details
- 
logger
protected final org.apache.commons.logging.Log logger 
 - 
 - 
Constructor Details
- 
DefaultContextLoadTimeWeaver
public DefaultContextLoadTimeWeaver() - 
DefaultContextLoadTimeWeaver
 
 - 
 - 
Method Details
- 
setBeanClassLoader
Description copied from interface:BeanClassLoaderAwareCallback that supplies the beanclass loaderto a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean'sInitializingBean.afterPropertiesSet()method or a custom init-method.- Specified by:
 setBeanClassLoaderin interfaceBeanClassLoaderAware- Parameters:
 classLoader- the owning class loader
 - 
createServerSpecificLoadTimeWeaver
 - 
destroy
public void destroy()Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
 destroyin interfaceDisposableBean
 - 
addTransformer
Description copied from interface:LoadTimeWeaverAdd aClassFileTransformerto be applied by thisLoadTimeWeaver.- Specified by:
 addTransformerin interfaceLoadTimeWeaver- Parameters:
 transformer- theClassFileTransformerto add
 - 
getInstrumentableClassLoader
Description copied from interface:LoadTimeWeaverReturn aClassLoaderthat supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers.May be the current
ClassLoader, or aClassLoadercreated by thisLoadTimeWeaverinstance.- Specified by:
 getInstrumentableClassLoaderin interfaceLoadTimeWeaver- Returns:
 - the 
ClassLoaderwhich will expose instrumented classes according to the registered transformers 
 - 
getThrowawayClassLoader
Description copied from interface:LoadTimeWeaverReturn a throwawayClassLoader, enabling classes to be loaded and inspected without affecting the parentClassLoader.Should not return the same instance of the
ClassLoaderreturned from an invocation ofLoadTimeWeaver.getInstrumentableClassLoader().- Specified by:
 getThrowawayClassLoaderin interfaceLoadTimeWeaver- Returns:
 - a temporary throwaway 
ClassLoader; should return a new instance for each call, with no existing state 
 
 -