クラス ServletWebServerApplicationContext
- 実装されているすべてのインターフェース:
CloseableSE、AutoCloseableSE、BeanFactory、HierarchicalBeanFactory、ListableBeanFactory、BeanDefinitionRegistry、ConfigurableWebServerApplicationContext、WebServerApplicationContext、ApplicationContext、ApplicationEventPublisher、ConfigurableApplicationContext、Lifecycle、MessageSource、AliasRegistry、EnvironmentCapable、ResourceLoader、ResourcePatternResolver、ThemeSource、ConfigurableWebApplicationContext、WebApplicationContext
- 既知の直属サブクラス
AnnotationConfigServletWebServerApplicationContext,XmlServletWebServerApplicationContext
ServletWebServerFactory Bean からブートストラップするために使用できる WebApplicationContext。 このコンテキストは、ApplicationContext 内で単一の ServletWebServerFactory Bean を検索することにより、WebServer を作成、初期化、実行します。ServletWebServerFactory は、標準の Spring の概念(依存性注入、ライフサイクルコールバック、プロパティプレースホルダー変数など)を自由に使用できます。
さらに、コンテキストで定義された ServletEE または FilterEE Bean は、Web サーバーに自動的に登録されます。単一のサーブレット Bean の場合、'/' マッピングが使用されます。複数のサーブレット Bean が見つかった場合は、小文字の Bean 名がマッピングプレフィックスとして使用されます。'dispatcherServlet' という名前のサーブレットは常に '/' にマッピングされます。フィルター Bean はすべての URL ('/*') にマッピングされます。
より高度な構成の場合、コンテキストは代わりに ServletContextInitializer インターフェース(ほとんどの場合 ServletRegistrationBean や FilterRegistrationBean)を実装する Bean を定義できます。二重登録を防ぐために、ServletContextInitializer Bean を使用すると、自動サーブレットおよびフィルター Bean 登録が無効になります。
このコンテキストは直接使用できますが、ほとんどの開発者は AnnotationConfigServletWebServerApplicationContext または XmlServletWebServerApplicationContext バリアントの使用を検討する必要があります。
- 導入:
- 2.0.0
- 作成者:
- Phillip Webb, Dave Syer, Scott Frederick
- 関連事項:
ネストされたクラスの要約
ネストされたクラス修飾子と型クラス説明static classユーザー定義のスコープを保存および復元するユーティリティクラス。クラス org.springframework.core.io.DefaultResourceLoader から継承されたネストクラス / インターフェース
DefaultResourceLoader.ClassPathContextResourceフィールドのサマリー
フィールドクラス org.springframework.context.support.AbstractApplicationContext から継承されたフィールド
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAMEインターフェース org.springframework.beans.factory.BeanFactory から継承されたフィールド
FACTORY_BEAN_PREFIXインターフェース org.springframework.context.ConfigurableApplicationContext から継承されたフィールド
APPLICATION_STARTUP_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAMEインターフェース org.springframework.web.context.ConfigurableWebApplicationContext から継承されたフィールド
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAMEインターフェース org.springframework.core.io.ResourceLoader から継承されたフィールド
CLASSPATH_URL_PREFIXインターフェース org.springframework.core.io.support.ResourcePatternResolver から継承されたフィールド
CLASSPATH_ALL_URL_PREFIXインターフェース org.springframework.web.context.WebApplicationContext から継承されたフィールド
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAMEコンストラクターの概要
コンストラクターコンストラクター説明新しいServletWebServerApplicationContextを作成します。指定されたDefaultListableBeanFactoryで新しいServletWebServerApplicationContextを作成します。メソッドのサマリー
修飾子と型メソッド説明protected voiddoClose()protected ResourcegetResourceByPath(StringSE path) Web サーバーアプリケーションコンテキストの名前空間を返します。名前空間が設定されていない場合はnullを返します。protected CollectionSE<ServletContextInitializer>組み込み Web サーバーで使用する必要があるServletContextInitializerを返します。コンテキストによって作成されたWebServerを返します。サーバーがまだ作成されていない場合はnullを返します。protected ServletWebServerFactory埋め込みWebServerの作成に使用する必要があるServletWebServerFactoryを返します。protected voidprotected voidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) ServletContextAwareProcessor を登録します。protected voidprepareWebApplicationContext(ServletContextEE servletContext) 指定された完全にロードされたServletContextEE を使用してWebApplicationContextを準備します。final voidrefresh()voidsetServerNamespace(StringSE serverNamespace) コンテキストのサーバー名前空間を設定します。voidsetServletConfig(ServletConfigEE servletConfig) クラス org.springframework.web.context.support.GenericWebApplicationContext から継承されたメソッド
createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourcePatternResolver, getServletContext, getTheme, initPropertySources, setConfigLocation, setConfigLocations, setNamespace, setServletContextクラス org.springframework.context.support.GenericApplicationContext から継承されたメソッド
cancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getClassLoader, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanDefinitionOverridable, isBeanNameInUse, refreshBeanFactory, refreshForAotProcessing, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setApplicationStartup, setClassLoader, setParent, setResourceLoaderクラス org.springframework.context.support.AbstractApplicationContext から継承されたメソッド
addApplicationListener, addBeanFactoryPostProcessor, assertBeanFactoryActive, close, containsBean, containsBeanDefinition, containsLocalBean, destroyBeans, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationStartup, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, removeApplicationListener, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toStringクラス org.springframework.core.io.DefaultResourceLoader から継承されたメソッド
addProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCacheクラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSEインターフェース org.springframework.core.AliasRegistry から継承されたメソッド
getAliasesインターフェース org.springframework.context.ApplicationContext から継承されたメソッド
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDateインターフェース org.springframework.context.ApplicationEventPublisher から継承されたメソッド
publishEvent, publishEventインターフェース org.springframework.beans.factory.support.BeanDefinitionRegistry から継承されたメソッド
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNamesインターフェース org.springframework.beans.factory.BeanFactory から継承されたメソッド
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchインターフェース org.springframework.context.ConfigurableApplicationContext から継承されたメソッド
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, getEnvironment, isActive, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParentインターフェース org.springframework.beans.factory.HierarchicalBeanFactory から継承されたメソッド
containsLocalBean, getParentBeanFactoryインターフェース org.springframework.beans.factory.ListableBeanFactory から継承されたメソッド
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotationインターフェース org.springframework.context.MessageSource から継承されたメソッド
getMessage, getMessage, getMessageインターフェース org.springframework.core.io.ResourceLoader から継承されたメソッド
getClassLoader, getResourceインターフェース org.springframework.core.io.support.ResourcePatternResolver から継承されたメソッド
getResources
フィールドの詳細
DISPATCHER_SERVLET_NAME
DispatcherServlet Bean 名の定数値。この名前のサーブレット Bean は「メイン」サーブレットと見なされ、デフォルトで自動的に "/" のマッピングが与えられます。デフォルトの動作を変更するには、ServletRegistrationBeanまたは別の Bean 名を使用できます。- 関連事項:
コンストラクターの詳細
ServletWebServerApplicationContext
public ServletWebServerApplicationContext()新しいServletWebServerApplicationContextを作成します。ServletWebServerApplicationContext
指定されたDefaultListableBeanFactoryで新しいServletWebServerApplicationContextを作成します。- パラメーター:
beanFactory- このコンテキストに使用する DefaultListableBeanFactory インスタンス
メソッドの詳細
postProcessBeanFactory
ServletContextAwareProcessor を登録します。- オーバーライド:
- クラス
GenericWebApplicationContextのpostProcessBeanFactory - 関連事項:
refresh
- 次で指定:
- インターフェース
ConfigurableApplicationContextのrefresh - オーバーライド:
- クラス
AbstractApplicationContextのrefresh - 例外:
BeansExceptionIllegalStateExceptionSE
onRefresh
protected void onRefresh()- オーバーライド:
- クラス
GenericWebApplicationContextのonRefresh
doClose
protected void doClose()- オーバーライド:
- クラス
AbstractApplicationContextのdoClose
getWebServerFactory
埋め込みWebServerの作成に使用する必要があるServletWebServerFactoryを返します。デフォルトでは、このメソッドはコンテキスト自体で適切な Bean を検索します。- 戻り値:
ServletWebServerFactory(非null)
getServletContextInitializerBeans
組み込み Web サーバーで使用する必要があるServletContextInitializerを返します。デフォルトでは、このメソッドは最初にServletContextInitializer、ServletEE、FilterEE および特定のEventListenerSE Bean を見つけようとします。- 戻り値:
- サーブレット初期化子 Bean
prepareWebApplicationContext
指定された完全にロードされたServletContextEE を使用してWebApplicationContextを準備します。このメソッドは通常ServletContextInitializer.onStartup(ServletContext)から呼び出され、通常ContextLoaderListenerによって提供される機能に似ています。- パラメーター:
servletContext- 運用サーブレットコンテキスト
getResourceByPath
- オーバーライド:
- クラス
GenericWebApplicationContextのgetResourceByPath
getServerNamespace
インターフェースからコピーされた説明:WebServerApplicationContextWeb サーバーアプリケーションコンテキストの名前空間を返します。名前空間が設定されていない場合はnullを返します。同じアプリケーションで複数の Web サーバーが実行されている場合の明確化に使用されます(たとえば、異なるポートで実行されている管理コンテキスト)。- 次で指定:
- インターフェース
WebServerApplicationContextのgetServerNamespace - 戻り値:
- サーバーの名前空間
setServerNamespace
インターフェースからコピーされた説明:ConfigurableWebServerApplicationContextコンテキストのサーバー名前空間を設定します。- 次で指定:
- インターフェース
ConfigurableWebServerApplicationContextのsetServerNamespace - パラメーター:
serverNamespace- サーバーの名前空間- 関連事項:
setServletConfig
- 次で指定:
- インターフェース
ConfigurableWebApplicationContextのsetServletConfig - オーバーライド:
- クラス
GenericWebApplicationContextのsetServletConfig
getServletConfig
- 次で指定:
- インターフェース
ConfigurableWebApplicationContextのgetServletConfig - オーバーライド:
- クラス
GenericWebApplicationContextのgetServletConfig
getWebServer
コンテキストによって作成されたWebServerを返します。サーバーがまだ作成されていない場合はnullを返します。- 次で指定:
- インターフェース
WebServerApplicationContextのgetWebServer - 戻り値:
- 組み込み Web サーバー