Please sign in to comment.
Initialize FrameworkServlet property sources eagerly
Prior to this change, FrameworkServlet#configureAndRefreshWebApplicationContext called #postProcessWebApplicationContext(wac) and #applyInitializers(wac) prior to #refresh, but because servlet-based property source stubs were not replaced until #refresh, any post-processing or initialization routines could not benefit from accessing the Environment to retrieve properties from the ServletContext or ServletConfig. The workaround to this problem is detailed in SPR-9610 - the user simply needed to call WebApplicationContextUtils#initServletPropertySources manually within their ApplicationContextInitializer (or overridden #postProcessWebApplicationContext method) This commit ensures that FrameworkServlet#configureAndRefreshWebApplicationContext calls WebApplicationContextUtils#initServletPropertySources eagerly, prior to invoking #postProcessWebApplicationContext and #applyInitializers. Related Javadoc has also been updated throughout to clarify the behavior of #initServletPropertySources, when it can be called and what the effects are, etc. Note also that a reproduction issue was added to demonstrate the problem and verify its resolution . : https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-9610 Issue: SPR-9610
- Loading branch information...
Showing with 44 additions and 13 deletions.
- +2 −0 spring-web/src/main/java/org/springframework/web/context/ConfigurableWebEnvironment.java
- +18 −9 spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java
- +18 −4 ...portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
- +6 −0 spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java