spring-framework / org.springframework.instrument.classloading / InstrumentationLoadTimeWeaver

InstrumentationLoadTimeWeaver

open class InstrumentationLoadTimeWeaver : LoadTimeWeaver

LoadTimeWeaver relying on VM Instrumentation.

Start the JVM specifying the Java agent to be used, like as follows:

-javaagent:path/to/org.springframework.instrument.jar

where org.springframework.instrument.jar is a JAR file containing the InstrumentationSavingAgent class, as shipped with Spring.

In Eclipse, for example, set the "Run configuration"'s JVM args to be of the form:

-javaagent:${project_loc}/lib/org.springframework.instrument.jar

Author
Rod Johnson

Author
Juergen Hoeller

Since
2.0

See Also
InstrumentationSavingAgent

Constructors

<init>

InstrumentationLoadTimeWeaver()

Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.

InstrumentationLoadTimeWeaver(classLoader: ClassLoader)

Create a new InstrumentationLoadTimeWeaver for the given ClassLoader.

Functions

addTransformer

open fun addTransformer(transformer: ClassFileTransformer): Unit

getInstrumentableClassLoader

open fun getInstrumentableClassLoader(): ClassLoader

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.

getThrowawayClassLoader

open fun getThrowawayClassLoader(): ClassLoader

This implementation always returns a SimpleThrowawayClassLoader.

isInstrumentationAvailable

open static fun isInstrumentationAvailable(): Boolean

Check whether an Instrumentation instance is available for the current VM.

removeTransformers

open fun removeTransformers(): Unit

Remove all registered transformers, in inverse order of registration.