This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Including Spring Configuration Files

Here's my situation :
- I have a full fledge 3D + Swing GUI
- I have a Web Service, exposed thanks to XFire ( I couldn't find any documentation on how to do it with JAX RPC Spring support)

Both parts of my application share quite a number of classes, but I think that maintaining 2 spring.xml files is a nightmare.
So here's a way to create a commons.xml file that is included by the other spring bean description files ?

The following way of splitting the beans definitions into several files is not really an option, since I want to expose a web service through xfire, and it looks like I have to use the xfire-servlet.xml file. It doesn't look like I can have several files, can I ?

ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
new String[] {"applicationContext.xml", "applicationContext-part2.xml"});
// of course, an ApplicationContext is just a BeanFactory
BeanFactory factory = (BeanFactory) appContext;