public class GenericWebApplicationContext extends GenericApplicationContext implements ConfigurableWebApplicationContext, ThemeSource
GenericApplicationContext
のサブクラス。ConfigurableWebApplicationContext
を実装しますが、web.xml
での宣言的なセットアップを意図していません。代わりに、ネストされたコンテキストを構築したり、WebApplicationInitializers
内で使用したりするなど、プログラムによるセットアップ用に設計されています。
構成ファイルから Bean 定義を読み取る WebApplicationContext を実装する場合は、AbstractRefreshableWebApplicationContext から派生させ、loadBeanDefinitions
メソッドの実装で Bean 定義を読み取ることを検討してください。
リソースパスをサーブレットコンテキストリソース、つまり Web アプリケーションルートのパスとして解釈します。絶対パス。Web アプリのルート外のファイルの場合、AbstractApplicationContext によって実装されている "file:" URL を介してアクセスできます。
AbstractApplicationContext
によって検出された特殊な Bean に加えて、このクラスはコンテキスト内で "themeSource" という名前の ThemeSource Bean を検出します。
DefaultResourceLoader.ClassPathContextResource
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAME
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_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
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
コンストラクターと説明 |
---|
GenericWebApplicationContext() 新しい GenericWebApplicationContext を作成します。 |
GenericWebApplicationContext(DefaultListableBeanFactory beanFactory) 指定された DefaultListableBeanFactory で新しい GenericWebApplicationContext を作成します。 |
GenericWebApplicationContext(DefaultListableBeanFactory beanFactory, ServletContextEE servletContext) 指定された DefaultListableBeanFactory で新しい GenericWebApplicationContext を作成します。 |
GenericWebApplicationContext(ServletContextEE servletContext) 指定された ServletContext の新しい GenericWebApplicationContext を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
protected ConfigurableEnvironment | createEnvironment() 新しい StandardServletEnvironment を作成して返します。 |
StringSE | getApplicationName() このコンテキストが属するデプロイされたアプリケーションの名前を返します。 |
StringSE[] | getConfigLocations() この Web アプリケーションコンテキストの設定場所を返します。指定がない場合は null を返します。 |
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 | setConfigLocation(StringSE configLocation) この Web アプリケーションコンテキストの構成場所を init-param スタイルで設定します。 |
void | setConfigLocations(StringSE... configLocations) この Web アプリケーションコンテキストの構成場所を設定します。 |
void | setNamespace(StringSE namespace) この Web アプリケーションコンテキストのネームスペースを設定して、デフォルトのコンテキスト設定場所の構築に使用します。 |
void | setServletConfig(ServletConfigEE servletConfig) この Web アプリケーションコンテキストの ServletConfig を設定します。 |
void | setServletContext(ServletContextEE servletContext) この WebApplicationContext が実行される ServletContext を設定します。 |
cancelRefresh, 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, setResourceLoader
addApplicationListener, addBeanFactoryPostProcessor, assertBeanFactoryActive, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, 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, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toString
addProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCache
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, refresh, registerShutdownHook, setClassLoader, setEnvironment, setId, setParent
getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
containsLocalBean, getParentBeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
getMessage, getMessage, getMessage
publishEvent, publishEvent
getResources
getClassLoader, getResource
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames
getAliases
public GenericWebApplicationContext()
public GenericWebApplicationContext(ServletContextEE servletContext)
servletContext
- 実行する ServletContextGenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
, AbstractApplicationContext.refresh()
public GenericWebApplicationContext(DefaultListableBeanFactory beanFactory)
beanFactory
- このコンテキストに使用する DefaultListableBeanFactory インスタンス setServletContext(javax.servlet.ServletContext)
, GenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
, AbstractApplicationContext.refresh()
public GenericWebApplicationContext(DefaultListableBeanFactory beanFactory, ServletContextEE servletContext)
beanFactory
- このコンテキストに使用する DefaultListableBeanFactory インスタンス servletContext
- 実行する ServletContextGenericApplicationContext.registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition)
, AbstractApplicationContext.refresh()
public void setServletContext(@Nullable ServletContextEE servletContext)
ConfigurableWebApplicationContext
の setServletContext
ConfigurableApplicationContext.refresh()
@Nullable public ServletContextEE getServletContext()
WebApplicationContext
WebApplicationContext
の getServletContext
public StringSE getApplicationName()
ApplicationContext
ApplicationContext
の getApplicationName
AbstractApplicationContext
の getApplicationName
protected ConfigurableEnvironment createEnvironment()
StandardServletEnvironment
を作成して返します。AbstractApplicationContext
の createEnvironment
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
AbstractApplicationContext
の postProcessBeanFactory
beanFactory
- アプリケーションコンテキストで使用される Bean ファクトリ ServletContextAwareProcessor
protected Resource getResourceByPath(StringSE path)
DefaultResourceLoader
の getResourceByPath
path
- リソースへのパス ServletContextResource
protected ResourcePatternResolver getResourcePatternResolver()
AbstractApplicationContext
の getResourcePatternResolver
ServletContextResourcePatternResolver
protected 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
public void setServletConfig(@Nullable ServletConfigEE servletConfig)
ConfigurableWebApplicationContext
ConfigurableWebApplicationContext
の setServletConfig
ConfigurableApplicationContext.refresh()
@Nullable public ServletConfigEE getServletConfig()
ConfigurableWebApplicationContext
ConfigurableWebApplicationContext
の getServletConfig
public void setNamespace(@Nullable StringSE namespace)
ConfigurableWebApplicationContext
ConfigurableWebApplicationContext
の setNamespace
@Nullable public StringSE getNamespace()
ConfigurableWebApplicationContext
ConfigurableWebApplicationContext
の getNamespace
public void setConfigLocation(StringSE configLocation)
ConfigurableWebApplicationContext
設定されていない場合、実装は、必要に応じて、指定された名前空間またはルート Web アプリケーションコンテキストのデフォルトを使用することになっています。
ConfigurableWebApplicationContext
の setConfigLocation
public void setConfigLocations(StringSE... configLocations)
ConfigurableWebApplicationContext
設定されていない場合、実装は、必要に応じて、指定された名前空間またはルート Web アプリケーションコンテキストのデフォルトを使用することになっています。
ConfigurableWebApplicationContext
の setConfigLocations
public StringSE[] getConfigLocations()
ConfigurableWebApplicationContext
null
を返します。ConfigurableWebApplicationContext
の getConfigLocations