Class InstrumentationLoadTimeWeaver
java.lang.Object
org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
- All Implemented Interfaces:
- LoadTimeWeaver
LoadTimeWeaver relying on VM Instrumentation.
 Start the JVM specifying the Java agent to be used — for example, as
 follows where spring-instrument-{version}.jar is a JAR file
 containing the InstrumentationSavingAgent class shipped with Spring
 and where {version} is the release version of the Spring
 Framework (e.g., 5.1.5.RELEASE).
 
-javaagent:path/to/spring-instrument-{version}.jar
 
In Eclipse, for example, add something similar to the following to the JVM arguments for the Eclipse "Run configuration":
-javaagent:${project_loc}/lib/spring-instrument-{version}.jar
- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new InstrumentationLoadTimeWeaver for the default ClassLoader.InstrumentationLoadTimeWeaver(ClassLoader classLoader) Create a new InstrumentationLoadTimeWeaver for the given ClassLoader.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddTransformer(ClassFileTransformer transformer) Add aClassFileTransformerto be applied by thisLoadTimeWeaver.We have the ability to weave the current class loader when starting the JVM in this way, so the instrumentable class loader will always be the current loader.This implementation always returns aSimpleThrowawayClassLoader.static booleanCheck whether an Instrumentation instance is available for the current VM.voidRemove all registered transformers, in inverse order of registration.
- 
Constructor Details- 
InstrumentationLoadTimeWeaverpublic InstrumentationLoadTimeWeaver()Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.
- 
InstrumentationLoadTimeWeaverCreate a new InstrumentationLoadTimeWeaver for the given ClassLoader.- Parameters:
- classLoader- the ClassLoader that registered transformers are supposed to apply to
 
 
- 
- 
Method Details- 
addTransformerDescription copied from interface:LoadTimeWeaverAdd aClassFileTransformerto be applied by thisLoadTimeWeaver.- Specified by:
- addTransformerin interface- LoadTimeWeaver
- Parameters:
- transformer- the- ClassFileTransformerto add
 
- 
getInstrumentableClassLoaderWe have the ability to weave the current class loader when starting the JVM in this way, so the instrumentable class loader will always be the current loader.- Specified by:
- getInstrumentableClassLoaderin interface- LoadTimeWeaver
- Returns:
- the ClassLoaderwhich will expose instrumented classes according to the registered transformers
 
- 
getThrowawayClassLoaderThis implementation always returns aSimpleThrowawayClassLoader.- Specified by:
- getThrowawayClassLoaderin interface- LoadTimeWeaver
- Returns:
- a temporary throwaway ClassLoader; should return a new instance for each call, with no existing state
 
- 
removeTransformerspublic void removeTransformers()Remove all registered transformers, in inverse order of registration.
- 
isInstrumentationAvailablepublic static boolean isInstrumentationAvailable()Check whether an Instrumentation instance is available for the current VM.- See Also:
- 
- getInstrumentation()
 
 
 
-