You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a ContextLoaderListener programmatically in a WebApplicationInitializer, I'd expect to be able to set the config location on the context like this:
Doing so would be consistent with how I can set the config location when programmatically creating a DispatcherServlet.
But this doesn't work because ContextLoader.configureAndRefreshWebApplicationContext() overwrites the config location with whatever the "contextConfigLocation" init parameter is set to (if it's not set, then it sets it to null, which in the case of XmlWebApplicationContext makes it try to load the default applicationContext.xml).
The workaround is to set the "contextConfigLocation" init param. But this is inconsistent with how it works with DispatcherServlet.
commit 79cdb9e136f790c8100699d9bba476782cd02c40 (HEAD, trunk, master)
Author: Chris Beams <cbeams@vmware.com>
Date: Mon Dec 12 14:42:24 2011 +0000
Preserve programmatically set context config locations
Prior to this fix, ContextLoader(Listener)'s would overwrite any
value set directly against a WebApplicationContext's #setConfigLocation
method. This is a likely scenario when using Spring 3.1's new
WebApplicationInitializer support.
Now a check is performed to ensure that the ContextLoader init-param
value is non-null before doing the overwriting.
Added tests to ensure that all expected precedence, overwriting and
defaulting of context config locations works as expected.
Issue: SPR-8510
Craig Walls opened SPR-8510 and commented
When creating a ContextLoaderListener programmatically in a WebApplicationInitializer, I'd expect to be able to set the config location on the context like this:
Doing so would be consistent with how I can set the config location when programmatically creating a DispatcherServlet.
But this doesn't work because ContextLoader.configureAndRefreshWebApplicationContext() overwrites the config location with whatever the "contextConfigLocation" init parameter is set to (if it's not set, then it sets it to null, which in the case of XmlWebApplicationContext makes it try to load the default applicationContext.xml).
The workaround is to set the "contextConfigLocation" init param. But this is inconsistent with how it works with DispatcherServlet.
Affects: 3.1 M2
Referenced from: commits 23e58aa
The text was updated successfully, but these errors were encountered: