I'm trying to externalize some properties, currently stored in a properties file, into a database. Then, on application startup, I'd like to load these properties and use them in a PropertyPlaceholderConfigurer in order to configure my application for the current environment. I've got a working prototype but there is 1 last gotcha that I need to try to work around.

I'm using Commons Configuration to load the properties from the database, and then I'm passing these properties into a PropertyPlaceholderConfigurer. The gotcha is, that I'd like the jdbcDriver, url, username, and password of the datasource being used by Commons Configuration to be configurable using system properties. I can't just rely on the PropertyPlaceholderConfigurer to replace these values for me, since this happens during the PropertyPlaceholderConfigurer's initalization.

Is there any way to replace the ${jdbcDriver}, ${jdbcUrl}, etc properties from system properties prior to the PropertyPlaceholderConfigurer's initalization. Is there a way to use 2 configurers and have one run prior to the other's initalization. Is there a way to scope these using multiple applicationContext.xml files? The only way I've thought to make this work is to have the datasource used for commons configuration to look up it's own properties, but this would require writing some custom code, which I'm trying to avoid. Any help would be appreciated.