public abstract class AbstractContextLoaderInitializer extends ObjectSE implements WebApplicationInitializer
ContextLoaderListener をサーブレットコンテキストに登録する WebApplicationInitializer 実装の便利な基本クラス。 サブクラスで実装する必要がある唯一のメソッドは createRootApplicationContext() で、これは registerContextLoaderListener(ServletContext) から呼び出されます。
| コンストラクターと説明 |
|---|
AbstractContextLoaderInitializer() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected abstract WebApplicationContext | createRootApplicationContext()ContextLoaderListener に提供される「ルート」アプリケーションコンテキストを作成します。 |
protected ApplicationContextInitializer<?>[] | getRootApplicationContextInitializers()ContextLoaderListener の作成に使用されているルートアプリケーションコンテキストに適用されるアプリケーションコンテキスト初期化子を指定します。 |
void | onStartup(ServletContextEE servletContext) この Web アプリケーションの初期化に必要なサーブレット、フィルター、リスナー context-params および属性を使用して、指定された ServletContextEE を構成します。 |
protected void | registerContextLoaderListener(ServletContextEE servletContext) 指定されたサーブレットコンテキストに対して ContextLoaderListener を登録します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
public void onStartup(ServletContextEE servletContext) throws ServletExceptionEE
WebApplicationInitializerServletContextEE を構成します。上記の例を参照してください。WebApplicationInitializer の onStartup servletContext - 初期化する ServletContext ServletExceptionEE - 指定された ServletContext に対する呼び出しが ServletException をスローした場合 protected void registerContextLoaderListener(ServletContextEE servletContext)
ContextLoaderListener を登録します。ContextLoaderListener は、createRootApplicationContext() テンプレートメソッドから返されたアプリケーションコンテキストで初期化されます。servletContext - リスナーを登録するサーブレットコンテキスト @Nullable protected abstract WebApplicationContext createRootApplicationContext()
ContextLoaderListener に提供される「ルート」アプリケーションコンテキストを作成します。 返されたコンテキストは ContextLoaderListener(WebApplicationContext) に委譲され、DispatcherServlet アプリケーションコンテキストの親コンテキストとして確立されます。そのため、通常、中間層サービス、データソースなどが含まれます。
null AbstractDispatcherServletInitializer@Nullable protected ApplicationContextInitializer<?>[] getRootApplicationContextInitializers()
ContextLoaderListener の作成に使用されているルートアプリケーションコンテキストに適用されるアプリケーションコンテキスト初期化子を指定します。