Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
blueprint-spring-1.0.0
-
None
-
None
Description
Blueprint Spring SpringApplicationContext uses its own ClassLoader.
This class loader implementation however is not handling calls to loadClass(String name, boolean resolve), which is used by other class loaders.
Therefore if we obtain class loader for app context and use it for example with Groovy, it will fail asĀ
@Override public Class<?> loadClass(String name) throws ClassNotFoundException...
Will not be called at all.
Proper implementation should be:
@Override public Class<?> loadClass(String name) throws ClassNotFoundException { return loadClass(name, false); } @Override public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { for (ClassLoader cl : parentClassLoaders) { try { Class<?> c = cl.loadClass(name); if (resolve) { resolveClass(c); } return c; } catch (ClassNotFoundException e) { // Ignore } } throw new ClassNotFoundException(name); }