But spring already supports this in a much cleaner method (IMO) without conditionals by just specifying the context files you want to use:
Code:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
new String[] {"applicationContext-domain.xml",
"applicationContext-domain-test.xml" });
Where domain is my live configuration and test overrides certain values in it to use a Hypersonic VM db instead. The override capability is why you don't need conditionals.

Originally Posted by
bryanhunt
This would mean that you could have one set of spring configuration files
for your entire application.
Just setting the testing property would enable your testing or live
configuration.
You would no longer have to maintain seperate config files for web and
multiple testing files for different configurations.