public abstract class AbstractAnnotationConfigDispatcherServletInitializer extends AbstractDispatcherServletInitializer
DispatcherServlet
を登録し、Java ベースの Spring 構成を使用する WebApplicationInitializer
。以下を実装するには実装が必要です。
getRootConfigClasses()
--「ルート」アプリケーションコンテキスト(非 Web インフラストラクチャ)構成用。getServletConfigClasses()
-- DispatcherServlet
アプリケーションコンテキスト (Spring MVC インフラストラクチャ) 構成用。 アプリケーションコンテキスト階層が不要な場合、アプリケーションは getRootConfigClasses()
を介してすべての構成を返し、getServletConfigClasses()
から null
を返すことがあります。
DEFAULT_SERVLET_NAME
logger
コンストラクターと説明 |
---|
AbstractAnnotationConfigDispatcherServletInitializer() |
修飾子と型 | メソッドと説明 |
---|---|
protected WebApplicationContext | createRootApplicationContext() ContextLoaderListener に提供される「ルート」アプリケーションコンテキストを作成します。 |
protected WebApplicationContext | createServletApplicationContext() DispatcherServlet に提供されるサーブレットアプリケーションコンテキストを作成します。 |
protected abstract ClassSE<?>[] | getRootConfigClasses() |
protected abstract ClassSE<?>[] | getServletConfigClasses() |
createDispatcherServlet, customizeRegistration, getServletApplicationContextInitializers, getServletFilters, getServletMappings, getServletName, isAsyncSupported, onStartup, registerDispatcherServlet, registerServletFilter
getRootApplicationContextInitializers, registerContextLoaderListener
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public AbstractAnnotationConfigDispatcherServletInitializer()
@Nullable protected WebApplicationContext createRootApplicationContext()
ContextLoaderListener
に提供される「ルート」アプリケーションコンテキストを作成します。 返されたコンテキストは ContextLoaderListener(WebApplicationContext)
に委譲され、DispatcherServlet
アプリケーションコンテキストの親コンテキストとして確立されます。そのため、通常、中間層サービス、データソースなどが含まれます。
この実装は AnnotationConfigWebApplicationContext
を作成し、getRootConfigClasses()
によって返されるアノテーション付きクラスを提供します。getRootConfigClasses()
が null
を返す場合、null
を返します。
AbstractContextLoaderInitializer
の createRootApplicationContext
null
AbstractDispatcherServletInitializer
protected WebApplicationContext createServletApplicationContext()
DispatcherServlet
に提供されるサーブレットアプリケーションコンテキストを作成します。 返されたコンテキストは、Spring の DispatcherServlet(WebApplicationContext)
に委譲されます。そのため、通常、コントローラー、ビューリゾルバー、ロケールリゾルバー、その他の Web 関連の Bean が含まれます。
この実装は AnnotationConfigWebApplicationContext
を作成し、getServletConfigClasses()
によって返されるアノテーション付きクラスを提供します。
@Nullable protected abstract ClassSE<?>[] getRootConfigClasses()
null