|
|
|
@ -30,11 +30,10 @@ import org.springframework.instrument.classloading.WeavingTransformer; |
|
|
|
* to loaded classes without the need to use a VM-wide agent. |
|
|
|
* to loaded classes without the need to use a VM-wide agent. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>To be registered using a |
|
|
|
* <p>To be registered using a |
|
|
|
* {@code <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/loader.html">Loader</a>} tag |
|
|
|
* {@code <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html">Loader</a>} tag |
|
|
|
* in Tomcat's {@code <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html">Context</a>} |
|
|
|
* in Tomcat's {@code <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/context.html">Context</a>} |
|
|
|
* definition in the {@code server.xml} file, with the Spring-provided "spring-instrument-tomcat.jar" |
|
|
|
* definition in the {@code server.xml} file, with the Spring-provided "spring-instrument-tomcat.jar" |
|
|
|
* file deployed into Tomcat's "server/lib" (for Tomcat 5.x) or "lib" (for Tomcat 6.x) directory. |
|
|
|
* file deployed into Tomcat's "lib" directory. The required configuration tag looks as follows: |
|
|
|
* The required configuration tag looks as follows: |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* <pre class="code"><Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/></pre> |
|
|
|
* <pre class="code"><Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/></pre> |
|
|
|
* |
|
|
|
* |
|
|
|
@ -44,10 +43,7 @@ import org.springframework.instrument.classloading.WeavingTransformer; |
|
|
|
* {@code getThrowawayClassLoader} methods mirror the corresponding methods |
|
|
|
* {@code getThrowawayClassLoader} methods mirror the corresponding methods |
|
|
|
* in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver. |
|
|
|
* in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>See the PetClinic sample application for a full example of this |
|
|
|
* <p><b>NOTE:</b> Requires Apache Tomcat version 6.0 or higher, as of Spring 4.0. |
|
|
|
* ClassLoader in action. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* <p><b>NOTE:</b> Requires Apache Tomcat version 5.0 or higher. |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* @author Costin Leau |
|
|
|
* @author Costin Leau |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -103,7 +99,7 @@ public class TomcatInstrumentableClassLoader extends WebappClassLoader { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ClassLoader getThrowawayClassLoader() { |
|
|
|
public ClassLoader getThrowawayClassLoader() { |
|
|
|
WebappClassLoader tempLoader = new WebappClassLoader(); |
|
|
|
WebappClassLoader tempLoader = new WebappClassLoader(); |
|
|
|
// Use reflection to copy all the fields since most of them are private on pre-5.5 Tomcat.
|
|
|
|
// Use reflection to copy all the fields since they are not exposed any other way.
|
|
|
|
shallowCopyFieldState(this, tempLoader); |
|
|
|
shallowCopyFieldState(this, tempLoader); |
|
|
|
return tempLoader; |
|
|
|
return tempLoader; |
|
|
|
} |
|
|
|
} |
|
|
|
|