Spring PropertySource and Environment

Tom Zeller tzeller at dragonacea.biz
Tue May 13 16:58:40 EDT 2014


> That looks mostly right, although in the code I've seen, the
> initializers are invoked just before the refresh(). So after any config
> resource loading, etc.

Ah, good point.

> To be clear, you shouldn't have to actually write any code like this, at
> least for the root web app context or Spring MVC dispatcher servlet
> context.  You just declare the initializer in web.xml, and the Spring
> ServletContextListener (ContextLoaderListener) does the rest.

Understood, and for tests, @ContextConfiguration takes an initializers
parameter. But, our ReloadableSpringService class uses
SpringSupport#newContext() to create a new application context, so we
will have to apply the custom app ctx initializer manually, IIUC. Most
of those services are in system/conf/services-system.xml, I think.


More information about the dev mailing list