Created
April 26, 2016 12:38
-
-
Save pfmiles/4232689225377c7fdedb808313d50352 to your computer and use it in GitHub Desktop.
应用中为自定义classloader获取parent classloader的一般逻辑
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static ClassLoader getParentClsLoader() { | |
| ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); | |
| if (ctxLoader != null) { | |
| try { | |
| ctxLoader.loadClass(CurrentClass.class.getName()); | |
| return ctxLoader; | |
| } catch (ClassNotFoundException e) { | |
| } | |
| } | |
| return CurrentClass.class.getClassLoader(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment