In a big enterprise application built using Spring how should the spring-context.xml file be split into more than one file so that we can avoid having a single file which is very huge. Are there any patterns or guidelines that should be followed while making the xml file so that it does not become very big.
In case I plan to split my xml file based on the business logic or the manner in which I have coded my application, is it possible to load them at the same time as there may be some DI class from one xml file to another.
Joined: Jan 28, 2008
It all depends on your design, and how you split your application (for example, are you packaging per layer or per feature). However, here's what I think. You should have an XML file per module, and if that is still huge, you can still split that into separate XML files depending on the layer, for example
As for your question regarding if you can inject beans defined in one XML into another bean defined in another XML, this is a sure thing (if you are loading all of the XML files in the same application context of course). Finally, if you are using eclipse, you can use the spring-ide plugin to define the different files, and you can create different sets of beans, which is going to help you with auto completion, and tells you if a bean you are referring to does not exist.