Apr 28th, 2010, 10:09 AM
Reloading file system contexts within a web context
We've got a fairly standard application-context.xml that imports several classpath sub-contexts.
Currently our database connections and memcached configurations are in custom XML outside of the WAR. We'd like to move this configuration to Spring, but keep them outside of the WAR for possibly reloading w/o deploying a new WAR and/or bouncing the container. Using the standard <import resource="file:/path/to/memcached.xml"/> doesn't allow for reloading.
Is this possible? I've been playing around with extending FileSystemXmlApplicationContext with the WebApplicationContext as the parent context but haven't really had any luck. I've exposed the refresh method via JMX, and it reloads the external XML context, but the parent context doesn't have access to the beans in the child. Is there a way to have the child context delegate up to the parent context for everything except refresh()?
Thanks for any input, direction or ideas.
Apr 28th, 2010, 10:16 AM
for database configuration you can use jndi. This is the best thing to do for your case. I Think
Apr 29th, 2010, 07:04 AM
Apr 29th, 2010, 07:30 AM
If we were using standard javax.sql.DataSources, I'd agree. I guess I could do some sort of wrapper around a DataSource and expose it w/ our custom API...