Alex322
Aug 18th, 2004, 11:01 AM
I'm writing an Eclipse plugin that uses Spring.
spring.jar is configured as one of the runtime libraries in my plugin.
Spring fails to load my classes, because it relies on Thread.currentThread().getContextClassLoader() to find them. What it should do is to use the Eclipse classloader.
Of course it doesn't know anything about it, so my workround was this:
Before instantiating the factory I set the context classloader.
Thread.currentThread().setContextClassLoader(MyPlu gin.class.getClassLoader());
I'm not sure but I think it has some sideeffects so I was wondering if this can be fixed in Spring or maybe there is a better solution already.
The easiest fix I can think of is to fallback to the classloader used by Spring itself, something like
Class.forName(..., true, BeanFactory.class.getClassLoader())
An even better solution would be to allow any custom classloading code to be plugged in.
Thanks,
Alex
spring.jar is configured as one of the runtime libraries in my plugin.
Spring fails to load my classes, because it relies on Thread.currentThread().getContextClassLoader() to find them. What it should do is to use the Eclipse classloader.
Of course it doesn't know anything about it, so my workround was this:
Before instantiating the factory I set the context classloader.
Thread.currentThread().setContextClassLoader(MyPlu gin.class.getClassLoader());
I'm not sure but I think it has some sideeffects so I was wondering if this can be fixed in Spring or maybe there is a better solution already.
The easiest fix I can think of is to fallback to the classloader used by Spring itself, something like
Class.forName(..., true, BeanFactory.class.getClassLoader())
An even better solution would be to allow any custom classloading code to be plugged in.
Thanks,
Alex