Top Description Fields Constructors Methods
org.springframework.context.support

public abstract Class AbstractApplicationContext

extends DefaultResourceLoader
implements ConfigurableApplicationContext
Class Inheritance
All Implemented Interfaces
org.springframework.context.ConfigurableApplicationContext, java.io.Closeable, java.lang.AutoCloseable, org.springframework.context.Lifecycle, org.springframework.context.ApplicationContext, org.springframework.core.io.support.ResourcePatternResolver, org.springframework.core.io.ResourceLoader, org.springframework.context.ApplicationEventPublisher, org.springframework.context.MessageSource, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.ListableBeanFactory, org.springframework.core.env.EnvironmentCapable
Known Direct Subclasses
org.springframework.context.support.AbstractRefreshableApplicationContext, org.springframework.context.support.GenericApplicationContext
Imports
java.io.IOException, java.lang.annotation.Annotation, java.util.ArrayList, .Collection, .Date, .LinkedHashSet, .List, .Locale, .Map, .Set, java.util.concurrent.atomic.AtomicBoolean, java.util.concurrent.locks.Lock, .ReentrantLock, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.BeansException, .CachedIntrospectionResults, org.springframework.beans.factory.BeanFactory, .NoSuchBeanDefinitionException, .ObjectProvider, org.springframework.beans.factory.config.AutowireCapableBeanFactory, .BeanFactoryPostProcessor, .ConfigurableListableBeanFactory, org.springframework.beans.support.ResourceEditorRegistrar, org.springframework.context.ApplicationContext, .ApplicationContextAware, .ApplicationEvent, .ApplicationEventPublisher, .ApplicationEventPublisherAware, .ApplicationListener, .ApplicationStartupAware, .ConfigurableApplicationContext, .EmbeddedValueResolverAware, .EnvironmentAware, .HierarchicalMessageSource, .LifecycleProcessor, .MessageSource, .MessageSourceAware, .MessageSourceResolvable, .NoSuchMessageException, .PayloadApplicationEvent, .ResourceLoaderAware, org.springframework.context.event.ApplicationEventMulticaster, .ContextClosedEvent, .ContextRefreshedEvent, .ContextStartedEvent, .ContextStoppedEvent, .SimpleApplicationEventMulticaster, org.springframework.context.expression.StandardBeanExpressionResolver, org.springframework.context.weaving.LoadTimeWeaverAware, .LoadTimeWeaverAwareProcessor, org.springframework.core.NativeDetector, .ResolvableType, org.springframework.core.annotation.AnnotationUtils, org.springframework.core.convert.ConversionService, org.springframework.core.env.ConfigurableEnvironment, .Environment, .StandardEnvironment, org.springframework.core.io.DefaultResourceLoader, .Resource, .ResourceLoader, org.springframework.core.io.support.PathMatchingResourcePatternResolver, .ResourcePatternResolver, org.springframework.core.metrics.ApplicationStartup, .StartupStep, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .ObjectUtils, .ReflectionUtils

Abstract implementation of the org.springframework.context.ApplicationContext interface. Doesn't mandate the type of storage used for configuration; simply implements common context functionality. Uses the Template Method design pattern, requiring concrete subclasses to implement abstract methods.

In contrast to a plain BeanFactory, an ApplicationContext is supposed to detect special beans defined in its internal bean factory: Therefore, this class automatically registers BeanFactoryPostProcessors, BeanPostProcessors, and ApplicationListeners which are defined as beans in the context.

A org.springframework.context.MessageSource may also be supplied as a bean in the context, with the name "messageSource"; otherwise, message resolution is delegated to the parent context. Furthermore, a multicaster for application events can be supplied as an "applicationEventMulticaster" bean of type org.springframework.context.event.ApplicationEventMulticaster in the context; otherwise, a default multicaster of type org.springframework.context.event.SimpleApplicationEventMulticaster will be used.

Implements resource loading by extending org.springframework.core.io.DefaultResourceLoader. Consequently treats non-URL resource paths as class path resources (supporting full class path resource names that include the package path, e.g. "mypackage/myresource.dat"), unless the getResourceByPath method is overridden in a subclass.

Authors
Rod Johnson, Juergen Hoeller, Mark Fisher, Stephane Nicoll, Sam Brannen, Sebastien Deleuze, Brian Clozel
Since
January 21, 2001
See Also
refreshBeanFactory, getBeanFactory, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.event.ApplicationEventMulticaster, org.springframework.context.ApplicationListener, org.springframework.context.MessageSource

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
active

Flag that indicates whether this context is currently active.

public static final String
private ApplicationEventMulticaster
applicationEventMulticaster

Helper class used in event publishing.

private final Set<ApplicationListener<?>>
applicationListeners

Statically specified listeners.

private ApplicationStartup
applicationStartup

Application startup metrics.

private final List<BeanFactoryPostProcessor>
beanFactoryPostProcessors

BeanFactoryPostProcessors to apply on refresh.

private final AtomicBoolean
closed

Flag that indicates whether this context has been closed already.

private String
displayName

Display name.

private Set<ApplicationEvent>
earlyApplicationEvents

ApplicationEvents published before the multicaster setup.

private Set<ApplicationListener<?>>
earlyApplicationListeners

Local listeners registered before refresh.

private ConfigurableEnvironment
environment

Environment used by this context.

private String
id

Unique id for this context, if any.

public static final String
LIFECYCLE_PROCESSOR_BEAN_NAME

The name of the LifecycleProcessor bean in the context.

private LifecycleProcessor
lifecycleProcessor

LifecycleProcessor for managing the lifecycle of beans within this context.

protected final Log
logger

Logger used by this class.

public static final String
MESSAGE_SOURCE_BEAN_NAME

The name of the MessageSource bean in the context.

private MessageSource
messageSource

MessageSource we delegate our implementation of this interface to.

private ApplicationContext
parent

Parent context.

private final ResourcePatternResolver
resourcePatternResolver

ResourcePatternResolver used by this context.

private Thread
shutdownHook

Reference to the JVM shutdown hook, if registered.

private long
startupDate

System time in milliseconds when this context started.

private final Lock
startupShutdownLock

Synchronization lock for "refresh" and "close".

private volatile Thread
startupShutdownThread

Currently active startup/shutdown thread.

Constructor Summary

AccessConstructor and Description
public
AbstractApplicationContext()

Create a new AbstractApplicationContext with no parent.

public
AbstractApplicationContext(ApplicationContext
the parent context
parent
)

Create a new AbstractApplicationContext with the given parent context.

Method Summary

Modifier and TypeMethod and Description
public void
addApplicationListener(ApplicationListener<?>
the ApplicationListener to register
listener
)

Implements org.springframework.context.ConfigurableApplicationContext.addApplicationListener.

Add a new ApplicationListener that will be notified on context events such as context refresh and context shutdown.

public void
addBeanFactoryPostProcessor(BeanFactoryPostProcessor
the factory processor to register
postProcessor
)

Implements org.springframework.context.ConfigurableApplicationContext.addBeanFactoryPostProcessor.

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.

protected void
assertBeanFactoryActive()

Assert that this context's BeanFactory is currently active, throwing an IllegalStateException if it isn't.

protected void
cancelRefresh(Throwable
the exception that led to the cancellation
ex
)

Cancel this context's refresh attempt, resetting the active flag after an exception got thrown.

public void
close()

Implements org.springframework.context.ConfigurableApplicationContext.close.

Close this application context, destroying all beans in its bean factory.

protected abstract void
closeBeanFactory()

Subclasses must implement this method to release their internal bean factory.

public boolean
containsBean(String
the name of the bean to query
name
)

Implements org.springframework.beans.factory.BeanFactory.containsBean.

Does this bean factory contain a bean definition or externally registered singleton instance with the given name?

public boolean
containsBeanDefinition(String
the name of the bean to look for
beanName
)

Implements org.springframework.beans.factory.ListableBeanFactory.containsBeanDefinition.

Check if this bean factory contains a bean definition with the given name.

public boolean
containsLocalBean(String
the name of the bean to query
name
)

Implements org.springframework.beans.factory.HierarchicalBeanFactory.containsLocalBean.

Return whether the local bean factory contains a bean of the given name, ignoring beans defined in ancestor contexts.

protected ConfigurableEnvironment
createEnvironment()

Create and return a new StandardEnvironment.

protected void
destroyBeans()

Template method for destroying all beans that this context manages.

protected void
doClose()

Actually performs context closing: publishes a ContextClosedEvent and destroys the singletons in the bean factory of this application context.

public <A extends Annotation> Set<A>
findAllAnnotationsOnBean(String
the name of the bean to look for annotations on
beanName
,
Class<A>
the type of annotation to look for (at class, interface or factory method level of the specified bean)
annotationType
,
boolean
whether a FactoryBean may get initialized just for the purpose of determining its object type
allowFactoryBeanInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.findAllAnnotationsOnBean.

Find all Annotation instances of annotationType on the specified bean, traversing its interfaces and superclasses if no annotation can be found on the given class itself, as well as checking the bean's factory method (if any).

public <A extends Annotation> A
findAnnotationOnBean(String
the name of the bean to look for annotations on
beanName
,
Class<A>
the type of annotation to look for (at class, interface or factory method level of the specified bean)
annotationType
)

Implements org.springframework.beans.factory.ListableBeanFactory.findAnnotationOnBean.

Find an Annotation of annotationType on the specified bean, traversing its interfaces and superclasses if no annotation can be found on the given class itself, as well as checking the bean's factory method (if any).

public <A extends Annotation> A
findAnnotationOnBean(String
the name of the bean to look for annotations on
beanName
,
Class<A>
the type of annotation to look for (at class, interface or factory method level of the specified bean)
annotationType
,
boolean
whether a FactoryBean may get initialized just for the purpose of determining its object type
allowFactoryBeanInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.findAnnotationOnBean.

Find an Annotation of annotationType on the specified bean, traversing its interfaces and superclasses if no annotation can be found on the given class itself, as well as checking the bean's factory method (if any).

protected void
finishBeanFactoryInitialization(ConfigurableListableBeanFactory beanFactory)

Finish the initialization of this context's bean factory, initializing all remaining singleton beans.

protected void
finishRefresh()

Finish the refresh of this context, invoking the LifecycleProcessor's onRefresh() method and publishing the org.springframework.context.event.ContextRefreshedEvent.

public String[]
getAliases(String
the bean name to check for aliases
name
)

Implements org.springframework.beans.factory.BeanFactory.getAliases.

Return the aliases for the given bean name, if any.

pack-priv ApplicationEventMulticaster

Returns:

the internal ApplicationEventMulticaster (never null)
getApplicationEventMulticaster
()

Return the internal ApplicationEventMulticaster used by the context.

public Collection<ApplicationListener<?>>
getApplicationListeners()

Return the list of statically specified ApplicationListeners.

public String
getApplicationName()

Implements org.springframework.context.ApplicationContext.getApplicationName.

Return a name for the deployed application that this context belongs to.

public ApplicationStartup
public AutowireCapableBeanFactory
getAutowireCapableBeanFactory()

Implements org.springframework.context.ApplicationContext.getAutowireCapableBeanFactory.

Return this context's internal bean factory as AutowireCapableBeanFactory, if already available.

public Object
getBean(String
the name of the bean to retrieve
name
)

Implements org.springframework.beans.factory.BeanFactory.getBean.

Return an instance, which may be shared or independent, of the specified bean.

public <T> T
getBean(String
the name of the bean to retrieve
name
,
Class<T>
type the bean must match; can be an interface or superclass
requiredType
)

Implements org.springframework.beans.factory.BeanFactory.getBean.

Return an instance, which may be shared or independent, of the specified bean.

public Object
getBean(String
the name of the bean to retrieve
name
,
Object...
arguments to use when creating a bean instance using explicit arguments (only applied when creating a new instance as opposed to retrieving an existing one)
args
)

Implements org.springframework.beans.factory.BeanFactory.getBean.

Return an instance, which may be shared or independent, of the specified bean.

public <T> T
getBean(Class<T>
type the bean must match; can be an interface or superclass
requiredType
)

Implements org.springframework.beans.factory.BeanFactory.getBean.

Return the bean instance that uniquely matches the given object type, if any.

public <T> T
getBean(Class<T>
type the bean must match; can be an interface or superclass
requiredType
,
Object...
arguments to use when creating a bean instance using explicit arguments (only applied when creating a new instance as opposed to retrieving an existing one)
args
)

Implements org.springframework.beans.factory.BeanFactory.getBean.

Return an instance, which may be shared or independent, of the specified bean.

public int
getBeanDefinitionCount()

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanDefinitionCount.

Return the number of beans defined in the factory.

public String[]
getBeanDefinitionNames()

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanDefinitionNames.

Return the names of all beans defined in this factory.

public abstract ConfigurableListableBeanFactory

Returns:

this application context's internal bean factory (never null)
getBeanFactory
()

Redeclares org.springframework.context.ConfigurableApplicationContext.getBeanFactory.

Subclasses must return their internal bean factory here.

public List<BeanFactoryPostProcessor>
getBeanFactoryPostProcessors()

Return the list of BeanFactoryPostProcessors that will get applied to the internal BeanFactory.

public String[]
getBeanNamesForAnnotation(Class<? extends Annotation>
the type of annotation to look for (at class, interface or factory method level of the specified bean)
annotationType
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForAnnotation.

Find all names of beans which are annotated with the supplied Annotation type, without creating corresponding bean instances yet.

public String[]
getBeanNamesForType(ResolvableType
the generically typed class or interface to match
type
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType.

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.

public String[]
getBeanNamesForType(ResolvableType
the generically typed class or interface to match
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
whether to initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check. Note that FactoryBeans need to be eagerly initialized to determine their type: So be aware that passing in "true" for this flag will initialize FactoryBeans and "factory-bean" references.
allowEagerInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType.

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.

public String[]
getBeanNamesForType(Class<?>
the class or interface to match, or null for all bean names
type
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType.

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.

public String[]
getBeanNamesForType(Class<?>
the class or interface to match, or null for all bean names
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
whether to initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check. Note that FactoryBeans need to be eagerly initialized to determine their type: So be aware that passing in "true" for this flag will initialize FactoryBeans and "factory-bean" references.
allowEagerInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType.

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.

public <T> ObjectProvider<T>
getBeanProvider(Class<T>
type the bean must match; can be an interface or superclass
requiredType
)

Implements org.springframework.beans.factory.BeanFactory.getBeanProvider.

Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.

public <T> ObjectProvider<T>
getBeanProvider(ResolvableType
type the bean must match; can be a generic type declaration
requiredType
)

Implements org.springframework.beans.factory.BeanFactory.getBeanProvider.

Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.

public <T> ObjectProvider<T>
getBeanProvider(Class<T>
type the bean must match; can be an interface or superclass
requiredType
,
boolean
whether stream-based access may initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check
allowEagerInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanProvider.

Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.

public <T> ObjectProvider<T>
getBeanProvider(ResolvableType
type the bean must match; can be a generic type declaration. Note that collection types are not supported here, in contrast to reflective injection points. For programmatically retrieving a list of beans matching a specific type, specify the actual bean type as an argument here and subsequently use ObjectProvider#orderedStream() or its lazy streaming/iteration options.
requiredType
,
boolean
whether stream-based access may initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check
allowEagerInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeanProvider.

Return a provider for the specified bean, allowing for lazy on-demand retrieval of instances, including availability and uniqueness options.

public <T> Map<String, T>
getBeansOfType(Class<T>
the class or interface to match, or null for all concrete beans
type
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeansOfType.

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.

public <T> Map<String, T>
getBeansOfType(Class<T>
the class or interface to match, or null for all concrete beans
type
,
boolean
whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)
includeNonSingletons
,
boolean
whether to initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check. Note that FactoryBeans need to be eagerly initialized to determine their type: So be aware that passing in "true" for this flag will initialize FactoryBeans and "factory-bean" references.
allowEagerInit
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeansOfType.

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.

public Map<String, Object>
getBeansWithAnnotation(Class<? extends Annotation>
the type of annotation to look for (at class, interface or factory method level of the specified bean)
annotationType
)

Implements org.springframework.beans.factory.ListableBeanFactory.getBeansWithAnnotation.

Find all beans which are annotated with the supplied Annotation type, returning a Map of bean names with corresponding bean instances.

public String

Returns:

a display name for this context (never null)
getDisplayName
()

Implements org.springframework.context.ApplicationContext.getDisplayName.

Return a friendly name for this context.

public ConfigurableEnvironment
getEnvironment()

Implements org.springframework.context.ConfigurableApplicationContext.getEnvironment.

Return the Environment for this application context in configurable form, allowing for further customization.

public String
getId()

Implements org.springframework.context.ApplicationContext.getId.

Return the unique id of this application context.

protected BeanFactory
getInternalParentBeanFactory()

Return the internal bean factory of the parent context if it implements ConfigurableApplicationContext; else, return the parent context itself.

protected MessageSource
getInternalParentMessageSource()

Return the internal message source of the parent context if it is an AbstractApplicationContext too; else, return the parent context itself.

pack-priv LifecycleProcessor

Returns:

the internal LifecycleProcessor (never null)
getLifecycleProcessor
()

Return the internal LifecycleProcessor used by the context.

public String
getMessage(String
the message code to look up, e.g. 'calculator.noRateSet'. MessageSource users are encouraged to base message names on qualified class or package names, avoiding potential conflicts and ensuring maximum clarity.
code
,
Object[]
an array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), or null if none
args
,
String
a default message to return if the lookup fails
defaultMessage
,
Locale
the locale in which to do the lookup
locale
)

Implements org.springframework.context.MessageSource.getMessage.

Try to resolve the message.

public String
getMessage(String
the message code to look up, e.g. 'calculator.noRateSet'. MessageSource users are encouraged to base message names on qualified class or package names, avoiding potential conflicts and ensuring maximum clarity.
code
,
Object[]
an array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), or null if none
args
,
Locale
the locale in which to do the lookup
locale
)

Implements org.springframework.context.MessageSource.getMessage.

Try to resolve the message.

public String
getMessage(MessageSourceResolvable
the value object storing attributes required to resolve a message (may include a default message)
resolvable
,
Locale
the locale in which to do the lookup
locale
)

Implements org.springframework.context.MessageSource.getMessage.

Try to resolve the message using all the attributes contained within the MessageSourceResolvable argument that was passed in.

Note

We must throw a NoSuchMessageException on this method since at the time of calling this method we aren't able to determine if the defaultMessage property of the resolvable is null or not.

private MessageSource

Returns:

the internal MessageSource (never null)
getMessageSource
()

Return the internal MessageSource used by the context.

public ApplicationContext
getParent()

Implements org.springframework.context.ApplicationContext.getParent.

Return the parent context, or null if there is no parent (that is, this context is the root of the context hierarchy).

public BeanFactory
getParentBeanFactory()

Implements org.springframework.beans.factory.HierarchicalBeanFactory.getParentBeanFactory.

Return the parent bean factory, or null if there is none.

protected ResourcePatternResolver

Returns:

the ResourcePatternResolver for this context
getResourcePatternResolver
()

Return the ResourcePatternResolver to use for resolving location patterns into Resource instances.

public Resource[]
getResources(String
the location pattern to resolve
locationPattern
)

Implements org.springframework.core.io.support.ResourcePatternResolver.getResources.

Resolve the given location pattern into Resource objects.

public long
getStartupDate()

Implements org.springframework.context.ApplicationContext.getStartupDate.

Return the timestamp (ms) when this context was first loaded.

public Class<?>
getType(String
the name of the bean to query
name
)

Implements org.springframework.beans.factory.BeanFactory.getType.

Determine the type of the bean with the given name.

public Class<?>
getType(String
the name of the bean to query
name
,
boolean
whether a FactoryBean may get initialized just for the purpose of determining its object type
allowFactoryBeanInit
)

Implements org.springframework.beans.factory.BeanFactory.getType.

Determine the type of the bean with the given name.

protected void
initApplicationEventMulticaster()

Initialize the ApplicationEventMulticaster.

protected void
initLifecycleProcessor()

Initialize the LifecycleProcessor.

protected void
initMessageSource()

Initialize the MessageSource.

protected void
initPropertySources()

Replace any stub property sources with actual instances.

protected void
invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory)

Instantiate and invoke all registered BeanFactoryPostProcessor beans, respecting explicit order if given.

public boolean
isActive()

Implements org.springframework.context.ConfigurableApplicationContext.isActive.

Determine whether this application context is active, that is, whether it has been refreshed at least once and has not been closed yet.

public boolean
isPrototype(String
the name of the bean to query
name
)

Implements org.springframework.beans.factory.BeanFactory.isPrototype.

Is this bean a prototype?

public boolean
isRunning()

Implements org.springframework.context.Lifecycle.isRunning.

Check whether this component is currently running.

public boolean
isSingleton(String
the name of the bean to query
name
)

Implements org.springframework.beans.factory.BeanFactory.isSingleton.

Is this bean a shared singleton?

private boolean
isStartupShutdownThreadStuck()

Determine whether an active startup/shutdown thread is currently stuck, e.g. through a System.exit call in a user component.

public boolean
isTypeMatch(String
the name of the bean to query
name
,
ResolvableType
the type to match against (as a ResolvableType)
typeToMatch
)

Implements org.springframework.beans.factory.BeanFactory.isTypeMatch.

Check whether the bean with the given name matches the specified type.

public boolean
isTypeMatch(String
the name of the bean to query
name
,
Class<?>
the type to match against (as a Class)
typeToMatch
)

Implements org.springframework.beans.factory.BeanFactory.isTypeMatch.

Check whether the bean with the given name matches the specified type.

protected ConfigurableListableBeanFactory

Returns:

the fresh BeanFactory instance
obtainFreshBeanFactory
()

Tell the subclass to refresh the internal bean factory.

protected void
onClose()

Template method which can be overridden to add context-specific shutdown work.

protected void
onRefresh()

Template method which can be overridden to add context-specific refresh work.

protected void
postProcessBeanFactory(ConfigurableListableBeanFactory
the bean factory used by the application context
beanFactory
)

Modify the application context's internal bean factory after its standard initialization.

protected void
prepareBeanFactory(ConfigurableListableBeanFactory
the BeanFactory to configure
beanFactory
)

Configure the factory's standard context characteristics, such as the context's ClassLoader and post-processors.

protected void
prepareRefresh()

Prepare this context for refreshing, setting its startup date and active flag as well as performing any initialization of property sources.

public void
publishEvent(ApplicationEvent
the event to publish (may be application-specific or a standard framework event)
event
)

Overrides default org.springframework.context.ApplicationEventPublisher.publishEvent.

Publish the given event to all listeners.

public void
publishEvent(Object
the event to publish (may be an ApplicationEvent or a payload object to be turned into a PayloadApplicationEvent)
event
)

Implements org.springframework.context.ApplicationEventPublisher.publishEvent.

Publish the given event to all listeners.

protected void
publishEvent(Object
the event to publish (may be an ApplicationEvent or a payload object to be turned into a PayloadApplicationEvent)
event
,
ResolvableType
the resolved event type, if known. The implementation of this method also tolerates a payload type hint for a payload object to be turned into a PayloadApplicationEvent. However, the recommended way is to construct an actual event object via PayloadApplicationEvent#PayloadApplicationEvent(Object, Object, ResolvableType) instead for such scenarios.
typeHint
)

Publish the given event to all listeners.

public void
refresh()

Implements org.springframework.context.ConfigurableApplicationContext.refresh.

Load or refresh the persistent representation of the configuration, which might be from Java-based configuration, an XML file, a properties file, a relational database schema, or some other format.

protected abstract void
refreshBeanFactory()

Subclasses must implement this method to perform the actual configuration load.

protected void
registerBeanPostProcessors(ConfigurableListableBeanFactory beanFactory)

Instantiate and register all BeanPostProcessor beans, respecting explicit order if given.

protected void
registerListeners()

Add beans that implement ApplicationListener as listeners.

public void
registerShutdownHook()

Implements org.springframework.context.ConfigurableApplicationContext.registerShutdownHook.

Register a shutdown hook named SpringContextShutdownHook with the JVM runtime, closing this context on JVM shutdown unless it has already been closed at that time.

public void
removeApplicationListener(ApplicationListener<?>
the ApplicationListener to deregister
listener
)

Implements org.springframework.context.ConfigurableApplicationContext.removeApplicationListener.

Remove the given ApplicationListener from this context's set of listeners, assuming it got registered via addApplicationListener before.

protected void
resetCommonCaches()

Reset Spring's common reflection metadata caches, in particular the ReflectionUtils, AnnotationUtils, ResolvableType and CachedIntrospectionResults caches.

public void
setApplicationStartup(ApplicationStartup
the new context event factory
applicationStartup
)

Implements org.springframework.context.ConfigurableApplicationContext.setApplicationStartup.

Set the ApplicationStartup for this application context.

public void
setDisplayName(String displayName)

Set a friendly name for this context.

public void
setEnvironment(ConfigurableEnvironment
the new environment
environment
)

Implements org.springframework.context.ConfigurableApplicationContext.setEnvironment.

Set the Environment for this application context.

public void
setId(String
the unique id of the context
id
)

Implements org.springframework.context.ConfigurableApplicationContext.setId.

Set the unique id of this application context.

public void
setParent(ApplicationContext
the parent context
parent
)

Implements org.springframework.context.ConfigurableApplicationContext.setParent.

Set the parent of this application context.

public void
start()

Implements org.springframework.context.Lifecycle.start.

Start this component.

public void
stop()

Implements org.springframework.context.Lifecycle.stop.

Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method.

public String
toString()

Overrides java.lang.Object.toString.

Return information about this context.

Inherited from org.springframework.core.io.DefaultResourceLoader:
addProtocolResolverclearResourceCachesgetClassLoadergetProtocolResolversgetResourcegetResourceByPathgetResourceCachesetClassLoader