Class ResourceOverridingShadowingClassLoader
- java.lang.Object
- java.lang.ClassLoader
- org.springframework.core.DecoratingClassLoader
- org.springframework.instrument.classloading.ShadowingClassLoader
- org.springframework.instrument.classloading.ResourceOverridingShadowingClassLoader
public class ResourceOverridingShadowingClassLoader extends ShadowingClassLoader
Subclass of ShadowingClassLoader that overrides attempts to locate certain files.- Since:
- 2.0
- Author:
- Rod Johnson, Adrian Colyer
Field Summary
Fields inherited from class org.springframework.instrument.classloading.ShadowingClassLoader
DEFAULT_EXCLUDED_PACKAGES
Fields inherited from class org.springframework.core.DecoratingClassLoader
parallelCapableClassLoaderAvailable
Constructor Summary
Constructors Constructor Description ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader)
Create a new ResourceOverridingShadowingClassLoader, decorating the given ClassLoader.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyOverrides(ResourceOverridingShadowingClassLoader other)
Copy all overrides from the given ClassLoader.URL
getResource(String requestedPath)
InputStream
getResourceAsStream(String requestedPath)
Enumeration<URL>
getResources(String requestedPath)
void
override(String oldPath, String newPath)
Return the resource (if any) at the new path on an attempt to locate a resource at the old path.void
suppress(String oldPath)
Ensure that a resource with the given path is not found.Methods inherited from class org.springframework.instrument.classloading.ShadowingClassLoader
addTransformer, copyTransformers, isEligibleForShadowing, loadClass
Methods inherited from class org.springframework.core.DecoratingClassLoader
excludeClass, excludePackage, isExcluded
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
Constructor Detail
ResourceOverridingShadowingClassLoader
public ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader)
Create a new ResourceOverridingShadowingClassLoader, decorating the given ClassLoader.- Parameters:
enclosingClassLoader
- the ClassLoader to decorate
Method Detail
override
public void override(String oldPath, String newPath)
Return the resource (if any) at the new path on an attempt to locate a resource at the old path.- Parameters:
oldPath
- the path requestednewPath
- the actual path to be looked up
suppress
public void suppress(String oldPath)
Ensure that a resource with the given path is not found.- Parameters:
oldPath
- the path of the resource to hide even if it exists in the parent ClassLoader
copyOverrides
public void copyOverrides(ResourceOverridingShadowingClassLoader other)
Copy all overrides from the given ClassLoader.- Parameters:
other
- the other ClassLoader to copy from
getResource
public URL getResource(String requestedPath)
- Overrides:
getResource
in classShadowingClassLoader
getResourceAsStream
public InputStream getResourceAsStream(String requestedPath)
- Overrides:
getResourceAsStream
in classShadowingClassLoader
getResources
public Enumeration<URL> getResources(String requestedPath) throws IOException
- Overrides:
getResources
in classShadowingClassLoader
- Throws:
IOException