类 InstrumentationLoadTimeWeaver
- java.lang.Object
- org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
- 所有已实现的接口:
LoadTimeWeaver
public class InstrumentationLoadTimeWeaver extends Object implements LoadTimeWeaver
LoadTimeWeaver
relying on VMInstrumentation
.Start the JVM specifying the Java agent to be used — for example, as follows where
spring-instrument-{version}.jar
is a JAR file containing theInstrumentationSavingAgent
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
- 从以下版本开始:
- 2.0
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
InstrumentationSavingAgent
构造器概要
构造器 构造器 说明 InstrumentationLoadTimeWeaver()
Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.InstrumentationLoadTimeWeaver(ClassLoader classLoader)
Create a new InstrumentationLoadTimeWeaver for the given ClassLoader.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addTransformer(ClassFileTransformer transformer)
Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.ClassLoader
getInstrumentableClassLoader()
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.ClassLoader
getThrowawayClassLoader()
This implementation always returns aSimpleThrowawayClassLoader
.static boolean
isInstrumentationAvailable()
Check whether an Instrumentation instance is available for the current VM.void
removeTransformers()
Remove all registered transformers, in inverse order of registration.
构造器详细资料
InstrumentationLoadTimeWeaver
public InstrumentationLoadTimeWeaver()
Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.
InstrumentationLoadTimeWeaver
public InstrumentationLoadTimeWeaver(@Nullable ClassLoader classLoader)
Create a new InstrumentationLoadTimeWeaver for the given ClassLoader.- 参数:
classLoader
- the ClassLoader that registered transformers are supposed to apply to
方法详细资料
addTransformer
public void addTransformer(ClassFileTransformer transformer)
从接口复制的说明:LoadTimeWeaver
Add aClassFileTransformer
to be applied by thisLoadTimeWeaver
.- 指定者:
addTransformer
在接口中LoadTimeWeaver
- 参数:
transformer
- theClassFileTransformer
to add
getInstrumentableClassLoader
public ClassLoader getInstrumentableClassLoader()
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.- 指定者:
getInstrumentableClassLoader
在接口中LoadTimeWeaver
- 返回:
- the
ClassLoader
which will expose instrumented classes according to the registered transformers
getThrowawayClassLoader
public ClassLoader getThrowawayClassLoader()
This implementation always returns aSimpleThrowawayClassLoader
.- 指定者:
getThrowawayClassLoader
在接口中LoadTimeWeaver
- 返回:
- a temporary throwaway
ClassLoader
; should return a new instance for each call, with no existing state
removeTransformers
public void removeTransformers()
Remove all registered transformers, in inverse order of registration.
isInstrumentationAvailable
public static boolean isInstrumentationAvailable()
Check whether an Instrumentation instance is available for the current VM.- 另请参阅:
getInstrumentation()