Class JarUrlClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
LaunchedClassLoader
URLClassLoader
with optimized support for Jar URLs.- Since:
- 3.2.0
- Author:
- Phillip Webb, Andy Wilkinson
-
Constructor Summary
ConstructorDescriptionJarUrlClassLoader
(URL[] urls, ClassLoader parent) Create a newLaunchedClassLoader
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear any caches.void
close()
protected final void
definePackageIfNecessary
(String className) Define a package before afindClass
call is made.findResource
(String name) findResources
(String name) protected Class<?>
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
JarUrlClassLoader
Create a newLaunchedClassLoader
instance.- Parameters:
urls
- the URLs from which to load classes and resourcesparent
- the parent class loader for delegation
-
-
Method Details
-
findResource
- Overrides:
findResource
in classURLClassLoader
-
findResources
- Overrides:
findResources
in classURLClassLoader
- Throws:
IOException
-
loadClass
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
definePackageIfNecessary
Define a package before afindClass
call is made. This is necessary to ensure that the appropriate manifest for nested JARs is associated with the package.- Parameters:
className
- the class name being found
-
clearCache
public void clearCache()Clear any caches. This method is called reflectively byClearCachesApplicationListener
. -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classURLClassLoader
- Throws:
IOException
-