クラス XmlWebApplicationContext
- 実装されたすべてのインターフェース:
CloseableSE
、AutoCloseableSE
、Aware
、BeanFactory
、BeanNameAware
、HierarchicalBeanFactory
、InitializingBean
、ListableBeanFactory
、ApplicationContext
、ApplicationEventPublisher
、ConfigurableApplicationContext
、Lifecycle
、MessageSource
、EnvironmentCapable
、ResourceLoader
、ResourcePatternResolver
、ThemeSource
、ConfigurableWebApplicationContext
、WebApplicationContext
XmlBeanDefinitionReader
が理解する XML ドキュメントから構成を取得する WebApplicationContext
実装。これは、本質的に Web 環境の GenericXmlApplicationContext
と同等です。デフォルトでは、構成はルートコンテキストの場合は "/WEB-INF/applicationContext.xml" から取得され、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.xml" から取得されます(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。
構成場所のデフォルトは、ContextLoader
の "contextConfigLocation" コンテキストパラメーターと FrameworkServlet
のサーブレット init-param を介して上書きできます。構成場所は、"/WEB-INF/context.xml" のような具体的なファイル、または "/WEB-INF/*-context.xml" のような Ant スタイルのパターンを示すことができます (パターンの詳細については、PathMatcher
javadoc を参照してください)。
メモ: 複数の構成ロケーションがある場合、後の Bean 定義は、以前にロードされたファイルで定義されたものをオーバーライドします。これを活用して、追加の XML ファイルを介して特定の Bean 定義を意図的にオーバーライドできます。
異なる Bean 定義形式を読み込む WebApplicationContext の場合は、AbstractRefreshableWebApplicationContext
の類似のサブクラスを作成します。このようなコンテキスト実装は、ContextLoader の場合は "contextClass" context-param、FrameworkServlet の場合は "contextClass" init-param として指定できます。
- 作成者:
- Rod Johnson, Juergen Hoeller
- 関連事項:
ネストされたクラスのサマリー
クラス org.springframework.core.io.DefaultResourceLoader から継承されたネストクラス / インターフェース
DefaultResourceLoader.ClassPathContextResource
フィールドのサマリー
フィールド修飾子と型フィールド説明static final StringSE
ルートコンテキストのデフォルトの設定場所。static final StringSE
名前空間の設定場所を構築するためのデフォルトのプレフィックス。static final StringSE
名前空間の設定場所を構築するためのデフォルトのサフィックス。クラス org.springframework.context.support.AbstractApplicationContext から継承されたフィールド
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
インターフェース org.springframework.beans.factory.BeanFactory から継承されたフィールド
FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHAR
インターフェース org.springframework.context.ConfigurableApplicationContext から継承されたフィールド
APPLICATION_STARTUP_BEAN_NAME, BOOTSTRAP_EXECUTOR_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
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明protected StringSE[]
ルートコンテキストのデフォルトの場所は "/WEB-INF/applicationContext.xml" であり、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.xml" です(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。protected void
initBeanDefinitionReader
(XmlBeanDefinitionReader beanDefinitionReader) このコンテキストの Bean 定義をロードするために使用される Bean 定義リーダーを初期化します。protected void
loadBeanDefinitions
(DefaultListableBeanFactory beanFactory) XmlBeanDefinitionReader を介して Bean 定義をロードします。protected void
指定された XmlBeanDefinitionReader で Bean 定義をロードします。クラス org.springframework.web.context.support.AbstractRefreshableWebApplicationContext から継承されたメソッド
createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourceByPath, getResourcePatternResolver, getServletConfig, getServletContext, getTheme, initPropertySources, onRefresh, postProcessBeanFactory, setNamespace, setServletConfig, setServletContext
クラス org.springframework.context.support.AbstractRefreshableConfigApplicationContext から継承されたメソッド
afterPropertiesSet, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setId
クラス org.springframework.context.support.AbstractRefreshableApplicationContext から継承されたメソッド
assertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences
クラス org.springframework.context.support.AbstractApplicationContext から継承されたメソッド
addApplicationListener, addBeanFactoryPostProcessor, clearResourceCaches, close, containsBean, containsBeanDefinition, containsLocalBean, destroyBeans, doClose, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationStartup, getAutowireCapableBeanFactory, 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, getResources, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isClosed, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, removeApplicationListener, resetCommonCaches, setApplicationStartup, setDisplayName, setEnvironment, setParent, start, stop, toString
クラス org.springframework.core.io.DefaultResourceLoader から継承されたメソッド
addProtocolResolver, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoader
クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
インターフェース org.springframework.context.ApplicationContext から継承されたメソッド
getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
インターフェース org.springframework.context.ApplicationEventPublisher から継承されたメソッド
publishEvent, publishEvent
インターフェース 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, isClosed, refresh, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParent
インターフェース org.springframework.web.context.ConfigurableWebApplicationContext から継承されたメソッド
setConfigLocation, setConfigLocations
インターフェース 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
フィールドの詳細
コンストラクターの詳細
XmlWebApplicationContext
public XmlWebApplicationContext()
メソッドの詳細
loadBeanDefinitions
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOExceptionSE XmlBeanDefinitionReader を介して Bean 定義をロードします。- 次で指定:
- クラス
AbstractRefreshableApplicationContext
のloadBeanDefinitions
- パラメーター:
beanFactory
- Bean 定義をロードする Bean ファクトリ- 例外:
BeansException
- Bean 定義の解析が失敗した場合IOExceptionSE
- Bean 定義ファイルのロードが失敗した場合- 関連事項:
initBeanDefinitionReader
このコンテキストの Bean 定義をロードするために使用される Bean 定義リーダーを初期化します。デフォルトの実装は空です。たとえば、XML 検証をオフにしたり、別の XmlBeanDefinitionParser 実装を使用したりするために、サブクラスでオーバーライドできます。
- パラメーター:
beanDefinitionReader
- このコンテキストで使用される Bean 定義リーダー- 関連事項:
loadBeanDefinitions
指定された XmlBeanDefinitionReader で Bean 定義をロードします。Bean ファクトリのライフサイクルは refreshBeanFactory メソッドによって処理されるため、このメソッドは Bean 定義をロードおよび / または登録することだけを目的としています。
ロケーションパターンをリソースインスタンスに解決するための ResourcePatternResolver へのデリゲート。
getDefaultConfigLocations
ルートコンテキストのデフォルトの場所は "/WEB-INF/applicationContext.xml" であり、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.xml" です(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。- オーバーライド:
- クラス
AbstractRefreshableConfigApplicationContext
のgetDefaultConfigLocations
- 戻り値:
- デフォルトの設定場所の配列(ある場合)
- 関連事項: