Spring and Eclipse  RCP



Background


I was trying out the Eclipse Rich Client Platform evaluating it for a project we are doing. Other project members were testing out Spring and after a short while, we tried to get our stuff togeter. This wasn't easy at first. Mostly because of the Eclipse class loader.

Tweaking Spring a bit to use a specified class loader for classes it has to load when creating the beans seems to have solved this problem.



Using the AlternateClassPathXmlApplicationContext (aka. Issues)


The AlternateClassPathXmlApplicationContext extends the ClassPathXmlApplicationContext and is dependent on some constructor parameters that was introduced in Spring 1.1. So it does not work on earlier versions of Spring.

When creating the ApplicationContext, the path strings need to have a leading '/' (E.g. ctx=new AlternateClassPathXmlApplicationContext("/applicationContext.xml"). I think this is a quirk of the Eclipse class loader, but I'm not sure.

Please be aware that this is a "quick fix" and that it has not been properly tested. It's more of a proof of concept.


Download


AlternateClassPathXmlApplicationContext
AlternateDriverManagerDataSource
The two above packaged as an Eclipse plugin
All the classes the Eclipse plugin depends on in a convenient Plugin