public interface ApplicationContext extends EnvironmentCapable, ListableBeanFactory, HierarchicalBeanFactory, MessageSource, ApplicationEventPublisher, ResourcePatternResolver
An ApplicationContext provides:
ListableBeanFactory
.
ResourceLoader
interface.
ApplicationEventPublisher
interface.
MessageSource
interface.
In addition to standard BeanFactory
lifecycle capabilities, ApplicationContext implementations detect and invoke
ApplicationContextAware
beans as well as ResourceLoaderAware
,
ApplicationEventPublisherAware
and MessageSourceAware
beans.
ConfigurableApplicationContext
,
BeanFactory
,
ResourceLoader
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getApplicationName()
Return a name for the deployed application that this context belongs to.
|
AutowireCapableBeanFactory |
getAutowireCapableBeanFactory()
Expose AutowireCapableBeanFactory functionality for this context.
|
java.lang.String |
getDisplayName()
Return a friendly name for this context.
|
java.lang.String |
getId()
Return the unique id of this application context.
|
ApplicationContext |
getParent()
Return the parent context, or
null if there is no parent
and this is the root of the context hierarchy. |
long |
getStartupDate()
Return the timestamp when this context was first loaded.
|
getEnvironment
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
containsLocalBean, getParentBeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch
getMessage, getMessage, getMessage
publishEvent
getResources
getClassLoader, getResource
java.lang.String getId()
null
if nonejava.lang.String getApplicationName()
java.lang.String getDisplayName()
null
)long getStartupDate()
ApplicationContext getParent()
null
if there is no parent
and this is the root of the context hierarchy.null
if there is no parentAutowireCapableBeanFactory getAutowireCapableBeanFactory() throws java.lang.IllegalStateException
This is not typically used by application code, except for the purpose of initializing bean instances that live outside the application context, applying the Spring bean lifecycle (fully or partly) to them.
Alternatively, the internal BeanFactory exposed by the
ConfigurableApplicationContext
interface offers access to the
AutowireCapableBeanFactory interface too. The present method mainly
serves as convenient, specific facility on the ApplicationContext
interface itself.
java.lang.IllegalStateException
- if the context does not support
the AutowireCapableBeanFactory interface or does not hold an autowire-capable
bean factory yet (usually if refresh()
has never been called)ConfigurableApplicationContext.refresh()
,
ConfigurableApplicationContext.getBeanFactory()