public class TomcatInstrumentableClassLoader extends WebappClassLoader
To be registered using a
Loader
tag
in Tomcat's Context
definition in the server.xml
file, with the Spring-provided "spring-instrument-tomcat.jar"
file deployed into Tomcat's "lib" directory. The required configuration tag looks as follows:
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
Typically used in combination with a
ReflectiveLoadTimeWeaver
defined in the Spring application context. The addTransformer
and
getThrowawayClassLoader
methods mirror the corresponding methods
in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver.
NOTE: Requires Apache Tomcat version 6.0 or higher, as of Spring 4.0.
This class is not intended to work on Tomcat 8.0+; please rely on Tomcat's own
InstrumentableClassLoader
facility instead, as autodetected by Spring's
TomcatLoadTimeWeaver
.
addTransformer(java.lang.instrument.ClassFileTransformer)
,
getThrowawayClassLoader()
,
ReflectiveLoadTimeWeaver
,
TomcatLoadTimeWeaver
Constructor and Description |
---|
TomcatInstrumentableClassLoader()
Create a new
TomcatInstrumentableClassLoader using the
current context class loader. |
TomcatInstrumentableClassLoader(java.lang.ClassLoader parent)
Create a new
TomcatInstrumentableClassLoader with the
supplied class loader as parent. |
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(java.lang.instrument.ClassFileTransformer transformer)
Delegate for LoadTimeWeaver's
addTransformer method. |
protected org.apache.catalina.loader.ResourceEntry |
findResourceInternal(java.lang.String name,
java.lang.String path) |
protected org.apache.catalina.loader.ResourceEntry |
findResourceInternal(java.lang.String name,
java.lang.String path,
boolean manifestRequired) |
java.lang.ClassLoader |
getThrowawayClassLoader()
Delegate for LoadTimeWeaver's
getThrowawayClassLoader method. |
java.lang.String |
toString() |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public TomcatInstrumentableClassLoader()
TomcatInstrumentableClassLoader
using the
current context class loader.public TomcatInstrumentableClassLoader(java.lang.ClassLoader parent)
TomcatInstrumentableClassLoader
with the
supplied class loader as parent.parent
- the parent ClassLoader
to be usedpublic void addTransformer(java.lang.instrument.ClassFileTransformer transformer)
addTransformer
method.
Typically called through ReflectiveLoadTimeWeaver.public java.lang.ClassLoader getThrowawayClassLoader()
getThrowawayClassLoader
method.
Typically called through ReflectiveLoadTimeWeaver.protected org.apache.catalina.loader.ResourceEntry findResourceInternal(java.lang.String name, java.lang.String path)
findResourceInternal
in class WebappClassLoader
protected org.apache.catalina.loader.ResourceEntry findResourceInternal(java.lang.String name, java.lang.String path, boolean manifestRequired)
findResourceInternal
in class WebappClassLoader
public java.lang.String toString()
toString
in class java.lang.Object