Skip to content

Instantly share code, notes, and snippets.

@qingniufly
Created March 15, 2017 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qingniufly/7f79028649f16dd8fde2fc74a84aa1de to your computer and use it in GitHub Desktop.
Save qingniufly/7f79028649f16dd8fde2fc74a84aa1de to your computer and use it in GitHub Desktop.
ClassLoader, Reflect
public class ReflectHelpers {
public static ClassLoader findClassLoader() {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if(classLoader == null) {
classLoader = ReflectHelpers.class.getClassLoader();
}
if(classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader();
}
return classLoader;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment