Class DefaultClassLoader


  • public class DefaultClassLoader
    extends Object
    • Constructor Detail

      • DefaultClassLoader

        public DefaultClassLoader()
    • Method Detail

      • getClassLoader

        public 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.

        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).

        Returns:
        the default ClassLoader (never null)
        See Also:
        Thread.getContextClassLoader()
      • getResourceAsStream

        public static InputStream getResourceAsStream​(String resource)
      • getResource

        public static URL getResource​(String resource)