Top Description Fields Constructors Methods
org.springframework.context.weaving

public Class DefaultContextLoadTimeWeaver

extends Object
implements LoadTimeWeaver, BeanClassLoaderAware, DisposableBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.Aware, org.springframework.instrument.classloading.LoadTimeWeaver
Imports
java.lang.instrument.ClassFileTransformer, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.BeanClassLoaderAware, .DisposableBean, org.springframework.instrument.InstrumentationSavingAgent, org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver, .LoadTimeWeaver, .ReflectiveLoadTimeWeaver, org.springframework.instrument.classloading.glassfish.GlassFishLoadTimeWeaver, org.springframework.instrument.classloading.jboss.JBossLoadTimeWeaver, org.springframework.instrument.classloading.tomcat.TomcatLoadTimeWeaver, org.springframework.lang.Nullable, org.springframework.util.Assert

Default 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.

Authors
Juergen Hoeller, Ramnivas Laddad, Costin Leau
Since
2.5
See Also
org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME

Field Summary

Modifier and TypeField and Description
private LoadTimeWeaver
protected final Log

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
addTransformer(ClassFileTransformer
the ClassFileTransformer to add
transformer
)

Implements org.springframework.instrument.classloading.LoadTimeWeaver.addTransformer.

Add a ClassFileTransformer to be applied by this LoadTimeWeaver.
protected LoadTimeWeaver
public void
destroy()

Implements org.springframework.beans.factory.DisposableBean.destroy.

Invoked by the containing BeanFactory on destruction of a bean.
public ClassLoader
getInstrumentableClassLoader()

Implements org.springframework.instrument.classloading.LoadTimeWeaver.getInstrumentableClassLoader.

Return a ClassLoader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers.
public ClassLoader
getThrowawayClassLoader()

Implements org.springframework.instrument.classloading.LoadTimeWeaver.getThrowawayClassLoader.

Return a throwaway ClassLoader, enabling classes to be loaded and inspected without affecting the parent ClassLoader.
public void
setBeanClassLoader(ClassLoader
the owning class loader
classLoader
)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean class loader to a bean instance.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loadTimeWeaverback to summary
private LoadTimeWeaver loadTimeWeaver
Annotations
@Nullable
loggerback to summary
protected final Log logger

Constructor Detail

DefaultContextLoadTimeWeaverback to summary
public DefaultContextLoadTimeWeaver()
DefaultContextLoadTimeWeaverback to summary
public DefaultContextLoadTimeWeaver(ClassLoader beanClassLoader)

Method Detail

addTransformerback to summary
public void addTransformer(ClassFileTransformer transformer)

Implements org.springframework.instrument.classloading.LoadTimeWeaver.addTransformer.

Doc from org.springframework.instrument.classloading.LoadTimeWeaver.addTransformer.

Add a ClassFileTransformer to be applied by this LoadTimeWeaver.

Parameters
transformer:ClassFileTransformer

the ClassFileTransformer to add

Annotations
@Override
createServerSpecificLoadTimeWeaverback to summary
protected LoadTimeWeaver createServerSpecificLoadTimeWeaver(ClassLoader classLoader)
Annotations
@Nullable
destroyback to summary
public void destroy()

Implements org.springframework.beans.factory.DisposableBean.destroy.

Doc from org.springframework.beans.factory.DisposableBean.destroy.

Invoked by the containing BeanFactory on destruction of a bean.

Annotations
@Override
getInstrumentableClassLoaderback to summary
public ClassLoader getInstrumentableClassLoader()

Implements org.springframework.instrument.classloading.LoadTimeWeaver.getInstrumentableClassLoader.

Doc from org.springframework.instrument.classloading.LoadTimeWeaver.getInstrumentableClassLoader.

Return a ClassLoader that supports instrumentation through AspectJ-style load-time weaving based on user-defined ClassFileTransformers.

May be the current ClassLoader, or a ClassLoader created by this LoadTimeWeaver instance.

Returns:ClassLoader

the ClassLoader which will expose instrumented classes according to the registered transformers

Annotations
@Override
getThrowawayClassLoaderback to summary
public ClassLoader getThrowawayClassLoader()

Implements org.springframework.instrument.classloading.LoadTimeWeaver.getThrowawayClassLoader.

Doc from org.springframework.instrument.classloading.LoadTimeWeaver.getThrowawayClassLoader.

Return a throwaway ClassLoader, enabling classes to be loaded and inspected without affecting the parent ClassLoader.

Should not return the same instance of the ClassLoader returned from an invocation of getInstrumentableClassLoader().

Returns:ClassLoader

a temporary throwaway ClassLoader; should return a new instance for each call, with no existing state

Annotations
@Override
setBeanClassLoaderback to summary
public void setBeanClassLoader(ClassLoader classLoader)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Doc from org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean class loader to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean's InitializingBean#afterPropertiesSet() method or a custom init-method.

Parameters
classLoader:ClassLoader

the owning class loader

Annotations
@Override