void
|
addApplicationListener(ApplicationListener<?> listener)
Add a new ApplicationListener that will be notified on context events
such as context refresh and context shutdown.
|
void
|
addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor)
Add a new BeanFactoryPostProcessor that will get applied to the internal
bean factory of this application context on refresh, before any of the
bean definitions get evaluated.
|
void
|
addListener(ApplicationListener<?> listener)
|
void
|
cancelRefresh(BeansException ex)
Cancel this context's refresh attempt, resetting the active flag
after an exception got thrown.
|
void
|
close()
Close this application context, destroying all beans in its bean factory.
|
abstract
void
|
closeBeanFactory()
Subclasses must implement this method to release their internal bean factory.
|
boolean
|
containsBean(String name)
Does this bean factory contain a bean with the given name? More specifically,
is getBean(Class) able to obtain a bean instance for the given name?
Translates aliases back to the corresponding canonical bean name.
|
boolean
|
containsBeanDefinition(String beanName)
Check if this bean factory contains a bean definition with the given name.
|
boolean
|
containsLocalBean(String name)
Return whether the local bean factory contains a bean of the given name,
ignoring beans defined in ancestor contexts.
|
ConfigurableEnvironment
|
createEnvironment()
|
void
|
destroy()
DisposableBean callback for destruction of this instance.
|
void
|
destroyBeans()
Template method for destroying all beans that this context manages.
|
void
|
doClose()
Actually performs context closing: publishes a ContextClosedEvent and
destroys the singletons in the bean factory of this application context.
|
<A extends Annotation>
A
|
findAnnotationOnBean(String beanName, Class<A> annotationType)
Find a Annotation of annotationType on the specified
bean, traversing its interfaces and super classes if no annotation can be
found on the given class itself.
|
void
|
finishBeanFactoryInitialization(ConfigurableListableBeanFactory beanFactory)
Finish the initialization of this context's bean factory,
initializing all remaining singleton beans.
|
void
|
finishRefresh()
Finish the refresh of this context, invoking the LifecycleProcessor's
onRefresh() method and publishing the
ContextRefreshedEvent .
|
String[]
|
getAliases(String name)
Return the aliases for the given bean name, if any.
|
Collection<ApplicationListener<?>>
|
getApplicationListeners()
Return the list of statically specified ApplicationListeners.
|
AutowireCapableBeanFactory
|
getAutowireCapableBeanFactory()
Return this context's internal bean factory as AutowireCapableBeanFactory,
if already available.
|
<T>
T
|
getBean(Class<T> requiredType)
Return the bean instance that uniquely matches the given object type, if any.
|
Object
|
getBean(String name, Object... args)
Return an instance, which may be shared or independent, of the specified bean.
|
<T>
T
|
getBean(String name, Class<T> requiredType)
Return an instance, which may be shared or independent, of the specified bean.
|
Object
|
getBean(String name)
Return an instance, which may be shared or independent, of the specified bean.
|
int
|
getBeanDefinitionCount()
Return the number of beans defined in the factory.
|
String[]
|
getBeanDefinitionNames()
Return the names of all beans defined in this factory.
|
abstract
ConfigurableListableBeanFactory
|
getBeanFactory()
Subclasses must return their internal bean factory here.
|
List<BeanFactoryPostProcessor>
|
getBeanFactoryPostProcessors()
Return the list of BeanFactoryPostProcessors that will get applied
to the internal BeanFactory.
|
String[]
|
getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
Return the names of beans matching the given type (including subclasses),
judging from either bean definitions or the value of getObjectType
in the case of FactoryBeans.
|
String[]
|
getBeanNamesForType(Class<?> type)
Return the names of beans matching the given type (including subclasses),
judging from either bean definitions or the value of getObjectType
in the case of FactoryBeans.
|
<T>
Map<String, T>
|
getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
Return the bean instances that match the given object type (including
subclasses), judging from either bean definitions or the value of
getObjectType in the case of FactoryBeans.
|
<T>
Map<String, T>
|
getBeansOfType(Class<T> type)
Return the bean instances that match the given object type (including
subclasses), judging from either bean definitions or the value of
getObjectType in the case of FactoryBeans.
|
Map<String, Object>
|
getBeansWithAnnotation(Class<? extends Annotation> annotationType)
Find all beans whose Class has the supplied Annotation type.
|
String
|
getDisplayName()
Return a friendly name for this context.
|
ConfigurableEnvironment
|
getEnvironment()
Return the Environment for this application context in configurable form.
|
String
|
getId()
Return the unique id of this application context.
|
BeanFactory
|
getInternalParentBeanFactory()
Return the internal bean factory of the parent context if it implements
ConfigurableApplicationContext; else, return the parent context itself.
|
MessageSource
|
getInternalParentMessageSource()
Return the internal message source of the parent context if it is an
AbstractApplicationContext too; else, return the parent context itself.
|
String
|
getMessage(MessageSourceResolvable resolvable, Locale locale)
Try to resolve the message using all the attributes contained within the
MessageSourceResolvable argument that was passed in.
|
String
|
getMessage(String code, Object[] args, Locale locale)
Try to resolve the message.
|
String
|
getMessage(String code, Object[] args, String defaultMessage, Locale locale)
Try to resolve the message.
|
ApplicationContext
|
getParent()
Return the parent context, or null if there is no parent
(that is, this context is the root of the context hierarchy).
|
BeanFactory
|
getParentBeanFactory()
Return the parent bean factory, or null if there is none.
|
ResourcePatternResolver
|
getResourcePatternResolver()
Return the ResourcePatternResolver to use for resolving location patterns
into Resource instances.
|
Resource[]
|
getResources(String locationPattern)
Resolve the given location pattern into Resource objects.
|
long
|
getStartupDate()
Return the timestamp (ms) when this context was first loaded.
|
Class<?>
|
getType(String name)
Determine the type of the bean with the given name.
|
void
|
initApplicationEventMulticaster()
Initialize the ApplicationEventMulticaster.
|
void
|
initLifecycleProcessor()
Initialize the LifecycleProcessor.
|
void
|
initMessageSource()
Initialize the MessageSource.
|
void
|
initPropertySources()
Replace any stub property sources with actual instances.
|
void
|
invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory)
Instantiate and invoke all registered BeanFactoryPostProcessor beans,
respecting explicit order if given.
|
boolean
|
isActive()
Determine whether this application context is active, that is,
whether it has been refreshed at least once and has not been closed yet.
|
boolean
|
isPrototype(String name)
Is this bean a prototype? That is, will getBean(Class) always return
independent instances?
Note: This method returning false does not clearly indicate
a singleton object.
|
boolean
|
isRunning()
Check whether this component is currently running.
|
boolean
|
isSingleton(String name)
Is this bean a shared singleton? That is, will getBean(Class) always
return the same instance?
Note: This method returning false does not clearly indicate
independent instances.
|
boolean
|
isTypeMatch(String name, Class<?> targetType)
Check whether the bean with the given name matches the specified type.
|
ConfigurableListableBeanFactory
|
obtainFreshBeanFactory()
Tell the subclass to refresh the internal bean factory.
|
void
|
onClose()
Template method which can be overridden to add context-specific shutdown work.
|
void
|
onRefresh()
Template method which can be overridden to add context-specific refresh work.
|
void
|
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Modify the application context's internal bean factory after its standard
initialization.
|
void
|
prepareBeanFactory(ConfigurableListableBeanFactory beanFactory)
Configure the factory's standard context characteristics,
such as the context's ClassLoader and post-processors.
|
void
|
prepareRefresh()
Prepare this context for refreshing, setting its startup date and
active flag as well as performing any initialization of property sources.
|
void
|
publishEvent(ApplicationEvent event)
Publish the given event to all listeners.
|
void
|
refresh()
Load or refresh the persistent representation of the configuration,
which might an XML file, properties file, or relational database schema.
|
abstract
void
|
refreshBeanFactory()
Subclasses must implement this method to perform the actual configuration load.
|
void
|
registerBeanPostProcessors(ConfigurableListableBeanFactory beanFactory)
Instantiate and invoke all registered BeanPostProcessor beans,
respecting explicit order if given.
|
void
|
registerListeners()
Add beans that implement ApplicationListener as listeners.
|
void
|
registerShutdownHook()
Register a shutdown hook with the JVM runtime, closing this context
on JVM shutdown unless it has already been closed at that time.
|
void
|
setDisplayName(String displayName)
Set a friendly name for this context.
|
void
|
setEnvironment(ConfigurableEnvironment environment)
Set the Environment for this application context.
Default value is determined by createEnvironment() .
|
void
|
setId(String id)
Set the unique id of this application context.
|
void
|
setParent(ApplicationContext parent)
Set the parent of this application context.
|
void
|
start()
Start this component.
|
void
|
stop()
Stop this component.
|
String
|
toString()
Return information about this context.
|