Support "contextInitializerClasses" init-param

FrameworkServlet now has support equivalent to ContextLoader and its
"contextInitializerClasses" context-param introduced in 3.1 M1.

This allows users to specify ApplicationContextInitializers at the root
(ContextLoader) level and/or at the DispatcherServlet level.

Issue: SPR-8366
This commit is contained in:
Chris Beams
2011-05-23 10:02:18 +00:00
parent 3c6254df90
commit 56720fc42c
2 changed files with 80 additions and 1 deletions

View File

@@ -20,6 +20,12 @@ package org.springframework.context;
* Callback interface for initializing a Spring {@link ConfigurableApplicationContext}
* prior to being {@linkplain ConfigurableApplicationContext#refresh() refreshed}.
*
* <p>Typically used within web applications that require some programmatic initialization
* of the application context. For example, registering property sources or activating
* profiles against the {@linkplain ConfigurableApplicationContext#getEnvironment()
* context's environment}. See {@code ContextLoader} and {@code FrameworkServlet} support
* for declaring a "contextInitializerClasses" context-param and init-param, respectively.
*
* <p>{@code ApplicationContextInitializer} processors are encouraged to detect
* whether Spring's {@link org.springframework.core.Ordered Ordered} or
* {@link org.springframework.core.PriorityOrdered PriorityOrdered} interfaces are also
@@ -29,6 +35,8 @@ package org.springframework.context;
* @since 3.1
* @see org.springframework.web.context.ContextLoader#customizeContext
* @see org.springframework.web.context.ContextLoader#CONTEXT_INITIALIZER_CLASSES_PARAM
* @see org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
* @see org.springframework.web.servlet.FrameworkServlet#initializeWebApplicationContext
*/
public interface ApplicationContextInitializer<C extends ConfigurableApplicationContext> {