Package org.springframework.web.context
Class AbstractContextLoaderInitializer
java.lang.Object
org.springframework.web.context.AbstractContextLoaderInitializer
- All Implemented Interfaces:
- WebApplicationInitializer
- Direct Known Subclasses:
- AbstractDispatcherServletInitializer
public abstract class AbstractContextLoaderInitializer
extends Object
implements WebApplicationInitializer
Convenient base class for 
WebApplicationInitializer implementations
 that register a ContextLoaderListener in the servlet context.
 The only method required to be implemented by subclasses is
 createRootApplicationContext(), which gets invoked from
 registerContextLoaderListener(ServletContext).
- Since:
- 3.2
- Author:
- Arjen Poutsma, Chris Beams, Juergen Hoeller
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract WebApplicationContextCreate the "root" application context to be provided to theContextLoaderListener.protected ApplicationContextInitializer<?>[]Specify application context initializers to be applied to the root application context that theContextLoaderListeneris being created with.voidonStartup(ServletContext servletContext) Configure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initializing this web application.protected voidregisterContextLoaderListener(ServletContext servletContext) Register aContextLoaderListeneragainst the given servlet context.
- 
Field Details- 
loggerLogger available to subclasses.
 
- 
- 
Constructor Details- 
AbstractContextLoaderInitializerpublic AbstractContextLoaderInitializer()
 
- 
- 
Method Details- 
onStartupDescription copied from interface:WebApplicationInitializerConfigure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initializing this web application. See examples above.- Specified by:
- onStartupin interface- WebApplicationInitializer
- Parameters:
- servletContext- the- ServletContextto initialize
- Throws:
- ServletException- if any call against the given- ServletContextthrows a- ServletException
 
- 
registerContextLoaderListenerRegister aContextLoaderListeneragainst the given servlet context. TheContextLoaderListeneris initialized with the application context returned from thecreateRootApplicationContext()template method.- Parameters:
- servletContext- the servlet context to register the listener against
 
- 
createRootApplicationContextCreate the "root" application context to be provided to theContextLoaderListener.The returned context is delegated to ContextLoaderListener(WebApplicationContext)and will be established as the parent context for anyDispatcherServletapplication contexts. As such, it typically contains middle-tier services, data sources, etc.- Returns:
- the root application context, or nullif a root context is not desired
- See Also:
 
- 
getRootApplicationContextInitializersSpecify application context initializers to be applied to the root application context that theContextLoaderListeneris being created with.
 
-