public class ServletWebServerApplicationContext extends org.springframework.web.context.support.GenericWebApplicationContext implements ConfigurableWebServerApplicationContext
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 バリアントの使用を検討する必要があります。
AnnotationConfigServletWebServerApplicationContext, XmlServletWebServerApplicationContext, ServletWebServerFactory| 修飾子と型 | クラスと説明 |
|---|---|
static class | ServletWebServerApplicationContext.ExistingWebApplicationScopes ユーザー定義のスコープを保存および復元するユーティリティクラス。 |
| 修飾子と型 | フィールドと説明 |
|---|---|
static StringSE | DISPATCHER_SERVLET_NAMEDispatcherServlet Bean 名の定数値。 |
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAMECONFIG_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_NAMECLASSPATH_ALL_URL_PREFIX| コンストラクターと説明 |
|---|
ServletWebServerApplicationContext() 新しい ServletWebServerApplicationContext を作成します。 |
ServletWebServerApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) 指定された DefaultListableBeanFactory で新しい ServletWebServerApplicationContext を作成します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected void | finishRefresh() |
protected org.springframework.core.io.Resource | getResourceByPath(StringSE path) |
StringSE | getServerNamespace()Web サーバーアプリケーションコンテキストの名前空間を返します。名前空間が設定されていない場合は null を返します。 |
ServletConfigEE | getServletConfig() |
protected CollectionSE<ServletContextInitializer> | getServletContextInitializerBeans() 組み込み Web サーバーで使用する必要がある ServletContextInitializer を返します。 |
WebServer | getWebServer() コンテキストによって作成された WebServer を返します。サーバーがまだ作成されていない場合は null を返します。 |
protected ServletWebServerFactory | getWebServerFactory() 埋め込み WebServer の作成に使用する必要がある ServletWebServerFactory を返します。 |
protected void | onClose() |
protected void | onRefresh() |
protected void | postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)ServletContextAwareProcessor を登録します。 |
protected void | prepareWebApplicationContext(ServletContextEE servletContext) 指定された完全にロードされた ServletContextEE を使用して WebApplicationContext を準備します。 |
void | refresh() |
void | setServerNamespace(StringSE serverNamespace) コンテキストのサーバー名前空間を設定します。 |
void | setServletConfig(ServletConfigEE servletConfig) |
createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourcePatternResolver, getServletContext, getTheme, initPropertySources, setConfigLocation, setConfigLocations, setNamespace, setServletContextcancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getClassLoader, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setClassLoader, setParent, setResourceLoaderaddApplicationListener, addBeanFactoryPostProcessor, assertBeanFactoryActive, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, getAliases, getApplicationListeners, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, 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, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toStringaddProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCachecloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEaddApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, registerShutdownHook, setEnvironment, setId, setParenthasServerNamespacegetApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDatecontainsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotationcontainsLocalBean, getParentBeanFactorycontainsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchpublishEvent, publishEventpublic static final StringSE DISPATCHER_SERVLET_NAME
ServletRegistrationBean または別の Bean 名を使用できます。public ServletWebServerApplicationContext()
ServletWebServerApplicationContext を作成します。public ServletWebServerApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
DefaultListableBeanFactory で新しい ServletWebServerApplicationContext を作成します。beanFactory - このコンテキストに使用する DefaultListableBeanFactory インスタンス protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
org.springframework.web.context.support.GenericWebApplicationContext の postProcessBeanFactory ServletContextAwareProcessorpublic final void refresh()
throws org.springframework.beans.BeansException,
IllegalStateExceptionSEorg.springframework.context.ConfigurableApplicationContext 内の refresh org.springframework.context.support.AbstractApplicationContext の refresh org.springframework.beans.BeansExceptionIllegalStateExceptionSEprotected void onRefresh()
org.springframework.web.context.support.GenericWebApplicationContext の onRefresh protected void finishRefresh()
org.springframework.context.support.AbstractApplicationContext の finishRefresh protected void onClose()
org.springframework.context.support.AbstractApplicationContext の onClose protected ServletWebServerFactory getWebServerFactory()
WebServer の作成に使用する必要がある ServletWebServerFactory を返します。デフォルトでは、このメソッドはコンテキスト自体で適切な Bean を検索します。ServletWebServerFactory (非 null)protected CollectionSE<ServletContextInitializer> getServletContextInitializerBeans()
ServletContextInitializer を返します。デフォルトでは、このメソッドは最初に ServletContextInitializer、ServletEE、FilterEE および特定の EventListenerSE Bean を見つけようとします。protected void prepareWebApplicationContext(ServletContextEE servletContext)
ServletContextEE を使用して WebApplicationContext を準備します。このメソッドは通常 ServletContextInitializer.onStartup(ServletContext) から呼び出され、通常 ContextLoaderListener によって提供される機能に似ています。servletContext - 運用サーブレットコンテキスト protected org.springframework.core.io.Resource getResourceByPath(StringSE path)
org.springframework.web.context.support.GenericWebApplicationContext の getResourceByPath public StringSE getServerNamespace()
WebServerApplicationContextnull を返します。同じアプリケーションで複数の Web サーバーが実行されている場合の明確化に使用されます(たとえば、異なるポートで実行されている管理コンテキスト)。WebServerApplicationContext 内の getServerNamespace public void setServerNamespace(StringSE serverNamespace)
ConfigurableWebServerApplicationContextConfigurableWebServerApplicationContext 内の setServerNamespace serverNamespace - サーバーの名前空間 WebServerApplicationContext.getServerNamespace()public void setServletConfig(ServletConfigEE servletConfig)
org.springframework.web.context.ConfigurableWebApplicationContext 内の setServletConfig org.springframework.web.context.support.GenericWebApplicationContext の setServletConfig public ServletConfigEE getServletConfig()
org.springframework.web.context.ConfigurableWebApplicationContext 内の getServletConfig org.springframework.web.context.support.GenericWebApplicationContext の getServletConfig public WebServer getWebServer()
WebServer を返します。サーバーがまだ作成されていない場合は null を返します。WebServerApplicationContext 内の getWebServer Copyright © 2019 Pivotal Software, Inc.. All rights reserved.