What is the current best practice for writing applications using Spring IoC that are configurable at runtime?
For example imagine a CMS application (lol - the mythical Spring based free CMS) that has a Configuration page.
When the admin user goes to this page they would be given the option to choose what authentication mechanism is used:
(*) Jdbc datasource - data source name [jdbc:// ]
( ) Tomcat container managed
( ) CAS
( ) Simple text file
From my currently limited understanding of Spring and Acegi, I can't see how this kind of runtime configuration change can be made easily.
The best solution I can see is having the application's main context XML use:
...and then in the configuration_choices directory we have authtype-beans.xml which is over-written by the configuration UI when the user changes the options, and contains only:
...if for example the user had chosen JDBC authentication.
This allows us to pre-ship bean configs for different config scenarios, without having to copy files / write out XML except for a trivial template-based XML file (shown above) that just has a single filename change in it.
This of course does not cater for:
1. Changing values within the pre-shipped bean config files
I understand that reloading is slated for 1.3 - is there any clean solution for it now?
Using Spring in a shared hosting environment - a requirement for getting, for something like a free java CMS to get any kind of mass usage - means that we can't restart the container when we want to reload. Also we can't guarantee that we can force a reload our app either.