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 SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
loggerprotected final org.apache.commons.logging.Log logger
 
- 
- 
Constructor Details- 
DefaultContextLoadTimeWeaverpublic DefaultContextLoadTimeWeaver()
- 
DefaultContextLoadTimeWeaver
 
- 
- 
Method Details- 
setBeanClassLoaderDescription 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 interface- BeanClassLoaderAware
- Parameters:
- classLoader- the owning class loader
 
- 
createServerSpecificLoadTimeWeaver
- 
destroypublic void destroy()Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
- destroyin interface- DisposableBean
 
- 
addTransformerDescription copied from interface:LoadTimeWeaverAdd aClassFileTransformerto be applied by thisLoadTimeWeaver.- Specified by:
- addTransformerin interface- LoadTimeWeaver
- Parameters:
- transformer- the- ClassFileTransformerto add
 
- 
getInstrumentableClassLoaderDescription 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 interface- LoadTimeWeaver
- Returns:
- the ClassLoaderwhich will expose instrumented classes according to the registered transformers
 
- 
getThrowawayClassLoaderDescription 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 interface- LoadTimeWeaver
- Returns:
- a temporary throwaway ClassLoader; should return a new instance for each call, with no existing state
 
 
-