public class TomcatInstrumentableClassLoader extends WebappClassLoader
To be registered using a
<a href="http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html">Loader</a>
tag
in Tomcat's <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/context.html">Context</a>
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(ClassLoader parent)
Create a new
TomcatInstrumentableClassLoader with the
supplied class loader as parent. |
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(ClassFileTransformer transformer)
Delegate for LoadTimeWeaver's
addTransformer method. |
protected org.apache.catalina.loader.ResourceEntry |
findResourceInternal(String name,
String path) |
protected org.apache.catalina.loader.ResourceEntry |
findResourceInternal(String name,
String path,
boolean manifestRequired) |
ClassLoader |
getThrowawayClassLoader()
Delegate for LoadTimeWeaver's
getThrowawayClassLoader method. |
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(ClassLoader parent)
TomcatInstrumentableClassLoader
with the
supplied class loader as parent.parent
- the parent ClassLoader
to be usedpublic void addTransformer(ClassFileTransformer transformer)
addTransformer
method.
Typically called through ReflectiveLoadTimeWeaver.public ClassLoader getThrowawayClassLoader()
getThrowawayClassLoader
method.
Typically called through ReflectiveLoadTimeWeaver.protected org.apache.catalina.loader.ResourceEntry findResourceInternal(String name, String path)
findResourceInternal
in class WebappClassLoader
protected org.apache.catalina.loader.ResourceEntry findResourceInternal(String name, String path, boolean manifestRequired)
findResourceInternal
in class WebappClassLoader