クラス ServletWebServerApplicationContext

実装されたすべてのインターフェース:
CloseableSEAutoCloseableSEBeanFactoryHierarchicalBeanFactoryListableBeanFactoryBeanDefinitionRegistryConfigurableWebServerApplicationContextWebServerApplicationContextApplicationContextApplicationEventPublisherConfigurableApplicationContextLifecycleMessageSourceAliasRegistryEnvironmentCapableResourceLoaderResourcePatternResolverThemeSourceConfigurableWebApplicationContextWebApplicationContext
既知の直属サブクラス
AnnotationConfigServletWebServerApplicationContextXmlServletWebServerApplicationContext

public class ServletWebServerApplicationContext extends GenericWebApplicationContext implements ConfigurableWebServerApplicationContext
含まれている ServletWebServerFactory Bean からブートストラップするために使用できる WebApplicationContext

このコンテキストは、ApplicationContext 内で単一の ServletWebServerFactory Bean を検索することにより、WebServer を作成、初期化、実行します。ServletWebServerFactory は、標準の Spring の概念(依存性注入、ライフサイクルコールバック、プロパティプレースホルダー変数など)を自由に使用できます。

さらに、コンテキストで定義された ServletEE または FilterEE Bean は、Web サーバーに自動的に登録されます。単一のサーブレット Bean の場合、"/" マッピングが使用されます。複数のサーブレット Bean が見つかった場合は、小文字の Bean 名がマッピングプレフィックスとして使用されます。'dispatcherServlet' という名前のサーブレットは常に '/' にマップされます。フィルター Bean はすべての URL('/*')にマップされます。

より高度な構成の場合、コンテキストは代わりに ServletContextInitializer インターフェース(ほとんどの場合 ServletRegistrationBeanFilterRegistrationBean)を実装する Bean を定義できます。二重登録を防ぐために、ServletContextInitializer Bean を使用すると、自動サーブレットおよびフィルター Bean 登録が無効になります。

このコンテキストは直接使用できますが、ほとんどの開発者は AnnotationConfigServletWebServerApplicationContext または XmlServletWebServerApplicationContext バリアントの使用を検討する必要があります。

導入:
2.0.0
作成者:
Phillip Webb, Dave Syer, Scott Frederick
関連事項: