public abstract class AbstractRefreshableWebApplicationContext extends AbstractRefreshableConfigApplicationContext implements ConfigurableWebApplicationContext, ThemeSource
ConfigurableWebApplicationContext インターフェースを実装する AbstractRefreshableApplicationContext サブクラス。Web アプリケーションの起動時に ConfigurableWebApplicationContext インターフェースを通じて設定される "configLocations" プロパティを提供します。 このクラスは AbstractRefreshableApplicationContext と同じくらい簡単にサブクラス化できます。実装する必要があるのは AbstractRefreshableApplicationContext.loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory) メソッドだけです。詳細については、スーパークラスの javadoc を参照してください。実装は、getConfigLocations() メソッドによって返された場所によって指定されたファイルから Bean 定義をロードすることになっていることに注意してください。
リソースパスをサーブレットコンテキストリソース、つまり Web アプリケーションルートのパスとして解釈します。絶対パス、たとえば Web アプリのルート外のファイルの場合は、DefaultResourceLoader によって実装される "file:" URL からアクセスできます。
AbstractApplicationContext によって検出された特殊な Bean に加えて、このクラスは、特殊な Bean 名 "themeSource" で、コンテキスト内の型 ThemeSource の Bean を検出します。
これは、異なる Bean 定義形式用にサブクラス化される Web コンテキストです。このようなコンテキスト実装は、デフォルトの XmlWebApplicationContext を置き換えて、ContextLoader の場合は "contextClass" コンテキストパラメーターとして、FrameworkServlet の場合は "contextClass" 初期パラメーターとして指定できます。その後、それぞれ "contextConfigLocation" コンテキストパラメーターまたは初期パラメーターが自動的に受信されます。
WebApplicationContext 実装は、通常、ConfigurableWebApplicationContext インターフェースを介して受信した構成に基づいて自身を構成することになっていることに注意してください。対照的に、スタンドアロンアプリケーションコンテキストでは、カスタムスタートアップコード(たとえば、GenericApplicationContext)での構成が可能になる場合があります。
DefaultResourceLoader.ClassPathContextResourceAPPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAMEAPPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAMECONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAMECONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAMEFACTORY_BEAN_PREFIXCLASSPATH_ALL_URL_PREFIXCLASSPATH_URL_PREFIX| コンストラクターと説明 |
|---|
AbstractRefreshableWebApplicationContext() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected ConfigurableEnvironment | createEnvironment() 新しい StandardServletEnvironment を作成して返します。 |
StringSE | getApplicationName() このコンテキストが属するデプロイされたアプリケーションの名前を返します。 |
StringSE[] | getConfigLocations() このコンテキストの構築に使用する XML Bean 定義ファイルを参照して、リソースの場所の配列を返します。 |
StringSE | getNamespace() この Web アプリケーションコンテキストのネームスペースがあれば、それを返します。 |
protected Resource | getResourceByPath(StringSE path) この実装は、ServletContext のルートのファイルパスをサポートします。 |
protected ResourcePatternResolver | getResourcePatternResolver() この実装は、拡張されていない WAR のパターンマッチングもサポートします。 |
ServletConfigEE | getServletConfig() この Web アプリケーションコンテキストの ServletConfig を返します(存在する場合)。 |
ServletContextEE | getServletContext() このアプリケーションの標準サーブレット API ServletContext を返します。 |
Theme | getTheme(StringSE themeName) 指定されたテーマ名のテーマインスタンスを返します。 |
protected void | initPropertySources() スタブプロパティソースを実際のインスタンスに置き換えます。 |
protected void | onRefresh() テーマ機能を初期化します。 |
protected void | postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) リクエスト / セッションスコープ、 ServletContextAwareProcessor などを登録します。 |
void | setNamespace(StringSE namespace) この Web アプリケーションコンテキストのネームスペースを設定して、デフォルトのコンテキスト設定場所の構築に使用します。 |
void | setServletConfig(ServletConfigEE servletConfig) この Web アプリケーションコンテキストの ServletConfig を設定します。 |
void | setServletContext(ServletContextEE servletContext) この Web アプリケーションコンテキストの ServletContext を設定します。 |
afterPropertiesSet, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setIdassertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, loadBeanDefinitions, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferencesaddApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setParent, start, stop, toStringaddProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoadercloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEsetConfigLocation, setConfigLocationsaddApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, refresh, registerShutdownHook, setEnvironment, setId, setParentgetAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDatecontainsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotationcontainsLocalBean, getParentBeanFactorycontainsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchgetMessage, getMessage, getMessagepublishEvent, publishEventgetResourcesgetClassLoader, getResourcepublic AbstractRefreshableWebApplicationContext()
public void setServletContext(@Nullable ServletContextEE servletContext)
ConfigurableWebApplicationContextコンテキストの初期化は行われません。すべての構成プロパティを設定した後で、リフレッシュを呼び出す必要があります。
ConfigurableWebApplicationContext の setServletContext ConfigurableApplicationContext.refresh()@Nullable public ServletContextEE getServletContext()
WebApplicationContextWebApplicationContext の getServletContext public void setServletConfig(@Nullable ServletConfigEE servletConfig)
ConfigurableWebApplicationContextConfigurableWebApplicationContext の setServletConfig ConfigurableApplicationContext.refresh()@Nullable public ServletConfigEE getServletConfig()
ConfigurableWebApplicationContextConfigurableWebApplicationContext の getServletConfig public void setNamespace(@Nullable StringSE namespace)
ConfigurableWebApplicationContextConfigurableWebApplicationContext の setNamespace @Nullable public StringSE getNamespace()
ConfigurableWebApplicationContextConfigurableWebApplicationContext の getNamespace public StringSE[] getConfigLocations()
AbstractRefreshableConfigApplicationContext デフォルトの実装は null を返します。サブクラスはこれをオーバーライドして、Bean 定義をロードするためのリソースロケーションのセットを提供できます。
ConfigurableWebApplicationContext の getConfigLocations AbstractRefreshableConfigApplicationContext の getConfigLocations null AbstractApplicationContext.getResources(java.lang.String), AbstractApplicationContext.getResourcePatternResolver()public StringSE getApplicationName()
ApplicationContextApplicationContext の getApplicationName AbstractApplicationContext の getApplicationName protected ConfigurableEnvironment createEnvironment()
StandardServletEnvironment を作成して返します。サブクラスは、環境を構成したり、返される環境型を特殊化したりするためにオーバーライドする場合があります。AbstractApplicationContext の createEnvironment protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
ServletContextAwareProcessor などを登録します。AbstractApplicationContext の postProcessBeanFactory beanFactory - アプリケーションコンテキストで使用される Bean ファクトリ protected Resource getResourceByPath(StringSE path)
DefaultResourceLoader の getResourceByPath path - リソースへのパス ServletContextResourceprotected ResourcePatternResolver getResourcePatternResolver()
AbstractApplicationContext の getResourcePatternResolver ServletContextResourcePatternResolverprotected void onRefresh()
AbstractApplicationContext の onRefresh AbstractApplicationContext.refresh()protected void initPropertySources()
スタブプロパティソースを実際のインスタンスに置き換えます。
Servlet 関連のプロパティソースを置き換えます。
@Nullable public Theme getTheme(StringSE themeName)
ThemeSource返されたテーマは、テーマ固有のメッセージ、コード、ファイルパスなどを解決します(例: Web 環境の CSS およびイメージファイル)。
ThemeSource の getTheme themeName - テーマの名前 null。慣例により、ThemeSource は少なくともデフォルトのテーマ名 "theme" のデフォルトのテーマを返すことができるはずですが、他のテーマ名のデフォルトのテーマを返すこともあります。AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME