public class DefaultClassLoader extends Object
Constructor and Description |
---|
DefaultClassLoader() |
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
getClassLoader()
Return the default ClassLoader to use: typically the thread context
ClassLoader, if available; the ClassLoader that loaded the ClassUtils
class will be used as fallback.
|
static URL |
getResource(String resource) |
static InputStream |
getResourceAsStream(String resource) |
public DefaultClassLoader()
public static ClassLoader getClassLoader()
Call this method if you intend to use the thread context ClassLoader
in a scenario where you absolutely need a non-null ClassLoader reference:
for example, for class path resource loading (but not necessarily for
Class.forName
, which accepts a null
ClassLoader
reference as well).
null
)Thread.getContextClassLoader()
public static InputStream getResourceAsStream(String resource)
public static URL getResource(String resource)
Copyright © 2012–2020 jkniv, copyleft code. All rights reserved.