Class SimpleLoadTimeWeaver
java.lang.Object
org.springframework.instrument.classloading.SimpleLoadTimeWeaver
- All Implemented Interfaces:
LoadTimeWeaver
LoadTimeWeaver
that builds and exposes a
SimpleInstrumentableClassLoader
.
Mainly intended for testing environments, where it is sufficient to
perform all class transformation on a newly created
ClassLoader
instance.
- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate a newSimpleLoadTimeWeaver
for the current contextClassLoader
.SimpleLoadTimeWeaver
(SimpleInstrumentableClassLoader classLoader) Create a newSimpleLoadTimeWeaver
for the givenClassLoader
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransformer
(ClassFileTransformer transformer) Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.Return aClassLoader
that supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers
.This implementation builds aSimpleThrowawayClassLoader
.
-
Constructor Details
-
SimpleLoadTimeWeaver
public SimpleLoadTimeWeaver()Create a newSimpleLoadTimeWeaver
for the current contextClassLoader
.- See Also:
-
SimpleLoadTimeWeaver
Create a newSimpleLoadTimeWeaver
for the givenClassLoader
.- Parameters:
classLoader
- theClassLoader
to build a simple instrumentableClassLoader
on top of
-
-
Method Details
-
addTransformer
Description copied from interface:LoadTimeWeaver
Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.- Specified by:
addTransformer
in interfaceLoadTimeWeaver
- Parameters:
transformer
- theClassFileTransformer
to add
-
getInstrumentableClassLoader
Description copied from interface:LoadTimeWeaver
Return aClassLoader
that supports instrumentation through AspectJ-style load-time weaving based on user-definedClassFileTransformers
.May be the current
ClassLoader
, or aClassLoader
created by thisLoadTimeWeaver
instance.- Specified by:
getInstrumentableClassLoader
in interfaceLoadTimeWeaver
- Returns:
- the
ClassLoader
which will expose instrumented classes according to the registered transformers
-
getThrowawayClassLoader
This implementation builds aSimpleThrowawayClassLoader
.- Specified by:
getThrowawayClassLoader
in interfaceLoadTimeWeaver
- Returns:
- a temporary throwaway
ClassLoader
; should return a new instance for each call, with no existing state
-