public class FileSystemXmlApplicationContext extends AbstractXmlApplicationContext
注 : プレーンパスは、スラッシュで始まっていても、常に現在の VM の作業ディレクトリに対する相対パスとして解釈されます。(これは、サーブレットコンテナーのセマンティクスと一致しています)明示的な "file:" プレフィックスを使用して、絶対ファイルパスを適用します。
構成場所のデフォルトは AbstractRefreshableConfigApplicationContext.getConfigLocations()
を介してオーバーライドできます。構成場所は、"/myfiles/context.xml" などの具象ファイルまたは "/myfiles/*-context.xml" などの Ant スタイルのパターンを示すことができます(パターンの詳細については、AntPathMatcher
javadoc を参照してください)。
メモ: 複数の構成ロケーションがある場合、後の Bean 定義は、以前にロードされたファイルで定義されたものをオーバーライドします。これを活用して、追加の XML ファイルを介して特定の Bean 定義を意図的にオーバーライドできます。
シンプルなワンストップショップ ApplicationContext です。より柔軟なコンテキスト設定のために、GenericApplicationContext
クラスを XmlBeanDefinitionReader
と組み合わせて使用することを検討してください。
DefaultResourceLoader.getResource(java.lang.String)
, getResourceByPath(java.lang.String)
, GenericApplicationContext
DefaultResourceLoader.ClassPathContextResource
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
コンストラクターと説明 |
---|
FileSystemXmlApplicationContext() Bean スタイルの構成用に新しい FileSystemXmlApplicationContext を作成します。 |
FileSystemXmlApplicationContext(ApplicationContext parent) Bean スタイルの構成用に新しい FileSystemXmlApplicationContext を作成します。 |
FileSystemXmlApplicationContext(java.lang.String... configLocations) 新しい FileSystemXmlApplicationContext を作成し、指定された XML ファイルから定義をロードして、コンテキストを自動的にリフレッシュします。 |
FileSystemXmlApplicationContext(java.lang.String configLocation) 新しい FileSystemXmlApplicationContext を作成し、指定された XML ファイルから定義をロードして、コンテキストを自動的にリフレッシュします。 |
FileSystemXmlApplicationContext(java.lang.String[] configLocations, ApplicationContext parent) 指定された親を使用して新しい FileSystemXmlApplicationContext を作成し、指定された XML ファイルから定義をロードして、コンテキストを自動的にリフレッシュします。 |
FileSystemXmlApplicationContext(java.lang.String[] configLocations, boolean refresh) 新しい FileSystemXmlApplicationContext を作成し、指定された XML ファイルから定義を読み込みます。 |
FileSystemXmlApplicationContext(java.lang.String[] configLocations, boolean refresh, ApplicationContext parent) 指定された親を使用して新しい FileSystemXmlApplicationContext を作成し、指定された XML ファイルから定義をロードします。 |
修飾子と型 | メソッドと説明 |
---|---|
protected Resource | getResourceByPath(java.lang.String path) リソースパスをファイルシステムパスとして解決します。 |
getConfigResources, initBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions, setValidating
afterPropertiesSet, getConfigLocations, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setId
assertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences
addApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setParent, start, stop, toString
addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoader
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addProtocolResolver
getClassLoader, getResource
public FileSystemXmlApplicationContext()
public FileSystemXmlApplicationContext(ApplicationContext parent)
public FileSystemXmlApplicationContext(java.lang.String configLocation) throws BeansException
configLocation
- ファイルパス BeansException
- コンテキストの作成に失敗した場合 public FileSystemXmlApplicationContext(java.lang.String... configLocations) throws BeansException
configLocations
- ファイルパスの配列 BeansException
- コンテキストの作成に失敗した場合 public FileSystemXmlApplicationContext(java.lang.String[] configLocations, ApplicationContext parent) throws BeansException
configLocations
- ファイルパスの配列 parent
- 親コンテキスト BeansException
- コンテキストの作成に失敗した場合 public FileSystemXmlApplicationContext(java.lang.String[] configLocations, boolean refresh) throws BeansException
configLocations
- ファイルパスの配列 refresh
- コンテキストを自動的にリフレッシュし、すべての Bean 定義をロードして、すべてのシングルトンを作成するかどうか。または、コンテキストをさらに構成した後、手動でリフレッシュを呼び出します。BeansException
- コンテキストの作成に失敗した場合 AbstractApplicationContext.refresh()
public FileSystemXmlApplicationContext(java.lang.String[] configLocations, boolean refresh, @Nullable ApplicationContext parent) throws BeansException
configLocations
- ファイルパスの配列 refresh
- コンテキストを自動的にリフレッシュし、すべての Bean 定義をロードして、すべてのシングルトンを作成するかどうか。または、コンテキストをさらに構成した後、手動でリフレッシュを呼び出します。parent
- 親コンテキスト BeansException
- コンテキストの作成に失敗した場合 AbstractApplicationContext.refresh()
protected Resource getResourceByPath(java.lang.String path)
メモ: 特定のパスがスラッシュで始まる場合でも、現在の VM 作業ディレクトリに対する相対パスとして解釈されます。これは、サーブレットコンテナーのセマンティクスと一致しています。
DefaultResourceLoader
の getResourceByPath
path
- リソースへのパス AbstractRefreshableWebApplicationContext.getResourceByPath(java.lang.String)