Class JBossLoadTimeWeaver
- java.lang.Object
- org.springframework.instrument.classloading.jboss.JBossLoadTimeWeaver
- All Implemented Interfaces:
LoadTimeWeaver
public class JBossLoadTimeWeaver extends Object implements LoadTimeWeaver
LoadTimeWeaverimplementation for JBoss's instrumentable ClassLoader. Autodetects the specific JBoss version at runtime: currently supports JBoss AS 6 and 7, as well as WildFly 8 and 9 (as of Spring 4.2).NOTE: On JBoss 6, to avoid the container loading the classes before the application actually starts, one needs to add a WEB-INF/jboss-scanning.xml file to the application archive - with the following content:
<scanning xmlns="urn:jboss:scanning:1.0"/>
Thanks to Ales Justin and Marius Bogoevici for the initial prototype.
- Since:
- 3.0
- Author:
- Costin Leau, Juergen Hoeller
Constructor Summary
Constructors Constructor Description JBossLoadTimeWeaver()Create a new instance of theJBossLoadTimeWeaverclass using the defaultclass loader.JBossLoadTimeWeaver(ClassLoader classLoader)Create a new instance of theJBossLoadTimeWeaverclass using the suppliedClassLoader.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTransformer(ClassFileTransformer transformer)Add aClassFileTransformerto be applied by thisLoadTimeWeaver.ClassLoadergetInstrumentableClassLoader()Return aClassLoaderthat supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers.ClassLoadergetThrowawayClassLoader()Return a throwawayClassLoader, enabling classes to be loaded and inspected without affecting the parentClassLoader.
Constructor Detail
JBossLoadTimeWeaver
public JBossLoadTimeWeaver()
Create a new instance of theJBossLoadTimeWeaverclass using the defaultclass loader.- See Also:
ClassUtils.getDefaultClassLoader()
JBossLoadTimeWeaver
public JBossLoadTimeWeaver(ClassLoader classLoader)
Create a new instance of theJBossLoadTimeWeaverclass using the suppliedClassLoader.- Parameters:
classLoader- theClassLoaderto delegate to for weaving (must not benull)
Method Detail
addTransformer
public void addTransformer(ClassFileTransformer transformer)
Description copied from interface:LoadTimeWeaverAdd aClassFileTransformerto be applied by thisLoadTimeWeaver.- Specified by:
addTransformerin interfaceLoadTimeWeaver- Parameters:
transformer- theClassFileTransformerto add
getInstrumentableClassLoader
public ClassLoader 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
public ClassLoader 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