public abstract class AbstractJohnsonContextLoaderInitializer
extends org.springframework.web.context.AbstractContextLoaderInitializer
AbstractDispatcherServletInitializer to use Johnson-aware components.
JohnsonContextListener will be registered before any other listeners that are registered
by this initializerJohnsonContextLoaderListener will be used to initialize the root ApplicationContext
In addition to using Johnson-aware components by default, this base class allows derived initializers to override
the ContextLoaderListener used. This is intended to
allow for application-specific handling on top of the Johnson-aware handling.
| Constructor and Description |
|---|
AbstractJohnsonContextLoaderInitializer() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.web.context.ContextLoaderListener |
createContextLoaderListener(org.springframework.web.context.WebApplicationContext context)
Creates a
JohnsonContextLoaderListener which will initialize and terminate the provided
WebApplicationContext. |
void |
onStartup(javax.servlet.ServletContext servletContext)
Registers a JohnsonContextListener and then
delegates to the superclass's onStartup(ServletContext) implementation. |
protected void |
registerContextLoaderListener(javax.servlet.ServletContext servletContext)
Overrides
AbstractContextLoaderInitializer's registerContextLoaderListener to register a
JohnsonContextLoaderListener instead of the
standard Spring ContextLoaderListener. |
protected void |
registerJohnsonContextListener(javax.servlet.ServletContext servletContext)
Registers an
JohnsonContextListener in in the provided ServletContext. |
public AbstractJohnsonContextLoaderInitializer()
protected org.springframework.web.context.ContextLoaderListener createContextLoaderListener(org.springframework.web.context.WebApplicationContext context)
JohnsonContextLoaderListener which will initialize and terminate the provided
WebApplicationContext. This method is provided as a convenience for derived classes to
simplify replacing the listener used.context - the WebApplicationContext to be initialized by the created listenerServletContextpublic void onStartup(javax.servlet.ServletContext servletContext)
throws javax.servlet.ServletException
Registers a JohnsonContextListener and then
delegates to the superclass's onStartup(ServletContext) implementation.onStartup in interface org.springframework.web.WebApplicationInitializeronStartup in class org.springframework.web.context.AbstractContextLoaderInitializerservletContext - the ServletContext to initializejavax.servlet.ServletException - potentially thrown by the superclass onStartup(ServletContext) implementationprotected void registerContextLoaderListener(javax.servlet.ServletContext servletContext)
AbstractContextLoaderInitializer's registerContextLoaderListener to register a
JohnsonContextLoaderListener instead of the
standard Spring ContextLoaderListener.registerContextLoaderListener in class org.springframework.web.context.AbstractContextLoaderInitializerservletContext - the ServletContext to register the JohnsonContextLoaderListener inprotected void registerJohnsonContextListener(javax.servlet.ServletContext servletContext)
JohnsonContextListener in in the provided ServletContext. This listener ensures
Johnson is initialized and terminated with the application.
Note: Even if this method is called multiple times, with its default implementation the listener will only be added once.
servletContext - the ServletContext to register the JohnsonContextListener inJohnsonContextListener.register(ServletContext)Copyright © 2017 Atlassian. All rights reserved.