public interface ApplicationContext extends EnvironmentCapable, ListableBeanFactory, HierarchicalBeanFactory, MessageSource, ApplicationEventPublisher, ResourcePatternResolver
ApplicationContext は以下を提供します。
ListableBeanFactory
から継承されます。ResourceLoader
インターフェースから継承されます。ApplicationEventPublisher
インターフェースから継承されます。MessageSource
インターフェースから継承されます。ApplicationContext 実装は、標準の BeanFactory
ライフサイクル機能に加えて、ApplicationContextAware
Bean、ResourceLoaderAware
、ApplicationEventPublisherAware
、MessageSourceAware
Bean を検出して呼び出します。
ConfigurableApplicationContext
, BeanFactory
, ResourceLoader
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
修飾子と型 | メソッドと説明 |
---|---|
StringSE | getApplicationName() このコンテキストが属するデプロイされたアプリケーションの名前を返します。 |
AutowireCapableBeanFactory | getAutowireCapableBeanFactory() このコンテキストの AutowireCapableBeanFactory 機能を公開します。 |
StringSE | getDisplayName() このコンテキストのフレンドリ名を返します。 |
StringSE | getId() このアプリケーションコンテキストの一意の ID を返します。 |
ApplicationContext | getParent() 親コンテキストを返します。親が存在せず、これがコンテキスト階層のルートである場合は null を返します。 |
long | getStartupDate() このコンテキストが最初にロードされたときのタイムスタンプを返します。 |
getEnvironment
containsBeanDefinition, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, 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
StringSE getApplicationName()
StringSE getDisplayName()
null
)long getStartupDate()
@Nullable ApplicationContext getParent()
null
を返します。null
AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateExceptionSE
これは、アプリケーションコンテキストの外部に存在する Bean インスタンスを初期化し、Spring Bean ライフサイクル(全体または一部)を適用する目的を除いて、通常アプリケーションコードでは使用されません。
あるいは、ConfigurableApplicationContext
インターフェースによって公開される内部 BeanFactory は、AutowireCapableBeanFactory
インターフェースへのアクセスも提供します。本方法は、主に、ApplicationContext インターフェース上の便利で特定の機能として機能します。
注: 4.2 以降、このメソッドは、アプリケーションコンテキストが閉じられた後、一貫して IllegalStateException をスローします。現在の Spring Framework バージョンでは、リフレッシュ可能なアプリケーションコンテキストのみがそのように動作します。4.2 では、すべてのアプリケーションコンテキストの実装が準拠する必要があります。
IllegalStateExceptionSE
- コンテキストが AutowireCapableBeanFactory
インターフェースをサポートしていない場合、またはオートワイヤー可能な Bean ファクトリをまだ保持していない場合(たとえば、refresh()
が呼び出されたことがない場合)、コンテキストがすでに閉じられている場合 ConfigurableApplicationContext.refresh()
, ConfigurableApplicationContext.getBeanFactory()