> > That's right, my code doesn't support a variable amount of databases at > the moment because > the databases are configured in Spring (inside my war file). > But if I use the context to configure this list of datasources, the admin > can create databases as he need. > And that's the reason why my configuration has to take place in the server > context and not hardcoded in the Spring configuration. > In Spring I can add more databases as I want, but I have to rebuild my war > file after change the datasource. > With a context configuration my war file can handle as many databases as > the admin configures. > The switch is done by the key of the map. >
So why don't you have a string resource in the context that provides the jndi names of all the jndi data sources, e.g. mydatasourceJndiNames=name1,name2,name3. Then have some code the lazily loads this string, splits it, and then loads these via jndi into your map? Chris