I don't know if it is your case, but I were looking for this many time. I have a project where I have a “tester” environment and a “real” environment. The problem is I have to keep two applicationContext.xml files: one for the testing and another one for the real application.
I searched for a solution to this, and I never found this… until I bumped with this code. Just so easy!!! An “import” tag!!!
Here is an example:
<?xml version="1.0" encoding="UTF-8"?> <beans ...> <import resource="applicationContext-beans.xml"/> </beans>