java.lang.Object | ||||
↳ | org.springframework.core.SimpleAliasRegistry | |||
↳ | org.springframework.beans.factory.support.DefaultSingletonBeanRegistry | |||
↳ | org.springframework.beans.factory.support.FactoryBeanRegistrySupport | |||
↳ | org.springframework.beans.factory.support.AbstractBeanFactory |
Known Direct Subclasses |
Known Indirect Subclasses |
Abstract base class for BeanFactory
implementations, providing the full capabilities of the
ConfigurableBeanFactory
SPI.
Does not assume a listable bean factory: can therefore also be used
as base class for bean factory implementations which obtain bean definitions
from some backend resource (where bean definition access is an expensive operation).
This class provides a singleton cache (through its base class
DefaultSingletonBeanRegistry
,
singleton/prototype determination, FactoryBean
handling, aliases, bean definition merging for child bean definitions,
and bean destruction (DisposableBean
interface, custom destroy methods). Furthermore, it can manage a bean factory
hierarchy (delegating to the parent in case of an unknown bean), through implementing
the HierarchicalBeanFactory
interface.
The main template methods to be implemented by subclasses are
getBeanDefinition(String)
and createBean(String, RootBeanDefinition, Object[])
, retrieving a bean definition
for a given bean name and creating a bean instance for a given bean definition,
respectively. Default implementations of those operations can be found in
DefaultListableBeanFactory
and AbstractAutowireCapableBeanFactory
.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.beans.factory.BeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.config.ConfigurableBeanFactory
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new AbstractBeanFactory.
| |||||||||||
Create a new AbstractBeanFactory with the given parent.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a new BeanPostProcessor that will get applied to beans created
by this factory.
| |||||||||||
Add a String resolver for embedded values such as annotation attributes.
| |||||||||||
Add a PropertyEditorRegistrar to be applied to all bean creation processes.
| |||||||||||
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. | |||||||||||
Return whether the local bean factory contains a bean of the given name,
ignoring beans defined in ancestor contexts.
| |||||||||||
Copy all relevant configuration from the given other factory.
| |||||||||||
Initialize the given PropertyEditorRegistry with the custom editors
that have been registered with this BeanFactory.
| |||||||||||
Destroy the given bean instance (usually a prototype instance
obtained from this factory) according to its bean definition.
| |||||||||||
Destroy the specified scoped bean in the current target scope, if any.
| |||||||||||
Delegate the creation of the access control context to the
SecurityContextProvider . | |||||||||||
Return the aliases for the given name, if defined.
| |||||||||||
Return an instance, which may be shared or independent, of the specified bean.
| |||||||||||
Return an instance, which may be shared or independent, of the specified bean.
| |||||||||||
Return an instance, which may be shared or independent, of the specified bean.
| |||||||||||
Return an instance, which may be shared or independent, of the specified bean.
| |||||||||||
Return this factory's class loader for loading bean classes.
| |||||||||||
Return the resolution strategy for expressions in bean definition values.
| |||||||||||
Return the current number of registered BeanPostProcessors, if any.
| |||||||||||
Return the list of BeanPostProcessors that will get applied
to beans created with this factory.
| |||||||||||
Return the associated ConversionService, if any.
| |||||||||||
Return the map of custom editors, with Classes as keys and PropertyEditor classes as values.
| |||||||||||
Return a 'merged' BeanDefinition for the given bean name,
merging a child bean definition with its parent if necessary.
| |||||||||||
Return the parent bean factory, or
null if there is none. | |||||||||||
Return the set of PropertyEditorRegistrars.
| |||||||||||
Return the Scope implementation for the given scope name, if any.
| |||||||||||
Return the names of all currently registered scopes.
| |||||||||||
Return the temporary ClassLoader to use for type matching purposes,
if any.
| |||||||||||
Determine the type of the bean with the given name.
| |||||||||||
Obtain a type converter as used by this BeanFactory.
| |||||||||||
Determine whether the given bean name is already in use within this factory,
i.e.
| |||||||||||
Return whether to cache bean metadata such as given bean definitions
(in merged fashion) and resolved bean classes.
| |||||||||||
Determine whether the specified bean is currently in creation.
| |||||||||||
Determine whether the bean with the given name is a FactoryBean.
| |||||||||||
Is this bean a prototype? That is, will
getBean(Class always return
independent instances?
Note: This method returning | |||||||||||
Is this bean a shared singleton? That is, will
getBean(Class always
return the same instance?
Note: This method returning | |||||||||||
Register the given custom property editor for all properties of the
given type.
| |||||||||||
Register the given scope, backed by the given Scope implementation.
| |||||||||||
Resolve the given embedded value, e.g.
| |||||||||||
Set the class loader to use for loading bean classes.
| |||||||||||
Specify the resolution strategy for expressions in bean definition values.
| |||||||||||
Set whether to cache bean metadata such as given bean definitions
(in merged fashion) and resolved bean classes.
| |||||||||||
Specify a Spring 3.0 ConversionService to use for converting
property values, as an alternative to JavaBeans PropertyEditors.
| |||||||||||
Set the parent of this bean factory.
| |||||||||||
Set the security context provider for this bean factory.
| |||||||||||
Specify a temporary ClassLoader to use for type matching purposes.
| |||||||||||
Set a custom type converter that this BeanFactory should use for converting
bean property values, constructor argument values, etc.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Callback after prototype creation.
| |||||||||||
Callback before prototype creation.
| |||||||||||
Check the given merged bean definition,
potentially throwing validation exceptions.
| |||||||||||
Remove the merged bean definition for the specified bean,
recreating it on next access.
| |||||||||||
Check if this bean factory contains a bean definition with the given name.
| |||||||||||
Create a bean instance for the given bean definition.
| |||||||||||
Destroy the given bean instance (usually a prototype instance
obtained from this factory) according to the given bean definition.
| |||||||||||
Return an instance, which may be shared or independent, of the specified bean.
| |||||||||||
Evaluate the given String as contained in a bean definition,
potentially resolving it as an expression.
| |||||||||||
Return the bean definition for the given bean name.
| |||||||||||
Return the custom TypeConverter to use, if any.
| |||||||||||
Return a RootBeanDefinition for the given top-level bean, by merging with
the parent if the given bean's definition is a child bean definition.
| |||||||||||
Return a RootBeanDefinition for the given bean, by merging with the
parent if the given bean's definition is a child bean definition.
| |||||||||||
Return a merged RootBeanDefinition, traversing the parent bean definition
if the specified bean corresponds to a child bean definition.
| |||||||||||
Get the object for the given bean instance, either the bean
instance itself or its created object in case of a FactoryBean.
| |||||||||||
Determine the bean type for the given FactoryBean definition, as far as possible.
| |||||||||||
Return whether this factory holds a DestructionAwareBeanPostProcessor
that will get applied to singleton beans on shutdown.
| |||||||||||
Return whether this factory holds a InstantiationAwareBeanPostProcessor
that will get applied to singleton beans on shutdown.
| |||||||||||
Initialize the given BeanWrapper with the custom editors registered
with this factory.
| |||||||||||
Determine whether the specified bean is eligible for having
its bean definition metadata cached.
| |||||||||||
Check whether the given bean is defined as a
FactoryBean . | |||||||||||
Return whether the specified prototype bean is currently in creation
(within the current thread).
| |||||||||||
Mark the specified bean as already created (or about to be created).
| |||||||||||
Determine the original bean name, resolving locally defined aliases to canonical names.
| |||||||||||
Predict the eventual bean type (of the processed bean instance) for the
specified bean.
| |||||||||||
Initialize the given PropertyEditorRegistry with the custom editors
that have been registered with this BeanFactory.
| |||||||||||
Add the given bean to the list of disposable beans in this factory,
registering its DisposableBean interface and/or the given destroy method
to be called on factory shutdown (if applicable).
| |||||||||||
Remove the singleton instance (if any) for the given bean name,
but only if it hasn't been used for other purposes than type checking.
| |||||||||||
Determine whether the given bean requires destruction on shutdown.
| |||||||||||
Resolve the bean class for the specified bean definition,
resolving a bean class name into a Class reference (if necessary)
and storing the resolved Class in the bean definition for further use.
| |||||||||||
Return the bean name, stripping out the factory dereference prefix if necessary,
and resolving aliases to canonical names.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.beans.factory.support.FactoryBeanRegistrySupport
| |||||||||||
From class
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
| |||||||||||
From class
org.springframework.core.SimpleAliasRegistry
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.HierarchicalBeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.config.ConfigurableBeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.config.SingletonBeanRegistry
| |||||||||||
From interface
org.springframework.core.AliasRegistry
|
Create a new AbstractBeanFactory with the given parent.
parentBeanFactory | parent bean factory, or null if none |
---|
Add a new BeanPostProcessor that will get applied to beans created by this factory. To be invoked during factory configuration.
Note: Post-processors submitted here will be applied in the order of
registration; any ordering semantics expressed through implementing the
Ordered
interface will be ignored. Note
that autodetected post-processors (e.g. as beans in an ApplicationContext)
will always be applied after programmatically registered ones.
beanPostProcessor | the post-processor to register |
---|
Add a String resolver for embedded values such as annotation attributes.
valueResolver | the String resolver to apply to embedded values |
---|
Add a PropertyEditorRegistrar to be applied to all bean creation processes.
Such a registrar creates new PropertyEditor instances and registers them
on the given registry, fresh for each bean creation attempt. This avoids
the need for synchronization on custom editors; hence, it is generally
preferable to use this method instead of registerCustomEditor(Class>, Class extends PropertyEditor>)
.
registrar | the PropertyEditorRegistrar to register |
---|
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. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to query |
---|
Return whether the local bean factory contains a bean of the given name, ignoring beans defined in ancestor contexts.
This is an alternative to containsBean
, ignoring a bean
of the given name from an ancestor bean factory.
name | the name of the bean to query |
---|
Copy all relevant configuration from the given other factory.
Should include all standard configuration settings as well as BeanPostProcessors, Scopes, and factory-specific internal settings. Should not include any metadata of actual bean definitions, such as BeanDefinition objects and bean name aliases.
otherFactory | the other BeanFactory to copy from |
---|
Initialize the given PropertyEditorRegistry with the custom editors that have been registered with this BeanFactory.
registry | the PropertyEditorRegistry to initialize |
---|
Destroy the given bean instance (usually a prototype instance obtained from this factory) according to its bean definition.
Any exception that arises during destruction should be caught and logged instead of propagated to the caller of this method.
beanName | the name of the bean definition |
---|---|
beanInstance | the bean instance to destroy |
Destroy the specified scoped bean in the current target scope, if any.
Any exception that arises during destruction should be caught and logged instead of propagated to the caller of this method.
beanName | the name of the scoped bean |
---|
Delegate the creation of the access control context to the
SecurityContextProvider
.
Return the aliases for the given name, if defined.
name | the name to check for aliases |
---|
Return an instance, which may be shared or independent, of the specified bean.
name | the name of the bean to retrieve |
---|---|
requiredType | the required type of the bean to retrieve |
args | arguments to use if creating a prototype using explicit arguments to a static factory method. It is invalid to use a non-null args value in any other case. |
BeansException | if the bean could not be created |
---|
Return an instance, which may be shared or independent, of the specified bean.
Allows for specifying explicit constructor arguments / factory method arguments, overriding the specified default arguments (if any) in the bean definition.
name | the name of the bean to retrieve |
---|---|
args | arguments to use if creating a prototype using explicit arguments to a static factory method. It is invalid to use a non-null args value in any other case. |
BeansException |
---|
Return an instance, which may be shared or independent, of the specified bean.
Behaves the same as getBean(String)
, but provides a measure of type
safety by throwing a BeanNotOfRequiredTypeException if the bean is not of the
required type. This means that ClassCastException can't be thrown on casting
the result correctly, as can happen with getBean(String)
.
Translates aliases back to the corresponding canonical bean name. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to retrieve |
---|---|
requiredType | type the bean must match. Can be an interface or superclass
of the actual class, or null for any match. For example, if the value
is Object.class , this method will succeed whatever the class of the
returned instance. |
BeansException |
---|
Return an instance, which may be shared or independent, of the specified bean.
This method allows a Spring BeanFactory to be used as a replacement for the Singleton or Prototype design pattern. Callers may retain references to returned objects in the case of Singleton beans.
Translates aliases back to the corresponding canonical bean name. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to retrieve |
---|
BeansException |
---|
Return this factory's class loader for loading bean classes.
Return the resolution strategy for expressions in bean definition values.
Return the current number of registered BeanPostProcessors, if any.
Return the list of BeanPostProcessors that will get applied to beans created with this factory.
Return the associated ConversionService, if any.
Return the map of custom editors, with Classes as keys and PropertyEditor classes as values.
Return a 'merged' BeanDefinition for the given bean name, merging a child bean definition with its parent if necessary.
This getMergedBeanDefinition
considers bean definition
in ancestors as well.
name | the name of the bean to retrieve the merged definition for (may be an alias) |
---|
NoSuchBeanDefinitionException | if there is no bean with the given name |
---|---|
BeanDefinitionStoreException | in case of an invalid bean definition |
BeansException |
Return the parent bean factory, or null
if there is none.
Return the set of PropertyEditorRegistrars.
Return the Scope implementation for the given scope name, if any.
This will only return explicitly registered scopes. Built-in scopes such as "singleton" and "prototype" won't be exposed.
scopeName | the name of the scope |
---|
null
if noneReturn the names of all currently registered scopes.
This will only return the names of explicitly registered scopes. Built-in scopes such as "singleton" and "prototype" won't be exposed.
Return the temporary ClassLoader to use for type matching purposes, if any.
Determine the type of the bean with the given name. More specifically,
determine the type of object that getBean(Class
would return for the given name.
For a FactoryBean
, return the type of object that the FactoryBean creates,
as exposed by getObjectType()
.
Translates aliases back to the corresponding canonical bean name. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to query |
---|
null
if not determinableObtain a type converter as used by this BeanFactory. This may be a fresh instance for each call, since TypeConverters are usually not thread-safe.
If the default PropertyEditor mechanism is active, the returned TypeConverter will be aware of all custom editors that have been registered.
Determine whether the given bean name is already in use within this factory, i.e. whether there is a local bean or alias registered under this name or an inner bean created with this name.
beanName | the name to check |
---|
Return whether to cache bean metadata such as given bean definitions (in merged fashion) and resolved bean classes.
Determine whether the specified bean is currently in creation.
beanName | the name of the bean |
---|
Determine whether the bean with the given name is a FactoryBean.
name | the name of the bean to check |
---|
false
means the bean exists but is not a FactoryBean)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. It indicates non-independent instances, which may correspond
to a scoped bean as well. Use the isSingleton(String)
operation to explicitly
check for a shared singleton instance.
Translates aliases back to the corresponding canonical bean name. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to query |
---|
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. It indicates non-singleton instances, which may correspond
to a scoped bean as well. Use the isPrototype(String)
operation to explicitly
check for independent instances.
Translates aliases back to the corresponding canonical bean name. Will ask the parent factory if the bean cannot be found in this factory instance.
name | the name of the bean to query |
---|
Register the given custom property editor for all properties of the given type. To be invoked during factory configuration.
Note that this method will register a shared custom editor instance;
access to that instance will be synchronized for thread-safety. It is
generally preferable to use addPropertyEditorRegistrar(PropertyEditorRegistrar)
instead
of this method, to avoid for the need for synchronization on custom editors.
requiredType | type of the property |
---|---|
propertyEditorClass | the PropertyEditor class to register
|
Register the given scope, backed by the given Scope implementation.
scopeName | the scope identifier |
---|---|
scope | the backing Scope implementation |
Resolve the given embedded value, e.g. an annotation attribute.
value | the value to resolve |
---|
Set the class loader to use for loading bean classes. Default is the thread context class loader.
Note that this class loader will only apply to bean definitions that do not carry a resolved bean class yet. This is the case as of Spring 2.0 by default: Bean definitions only carry bean class names, to be resolved once the factory processes the bean definition.
beanClassLoader | the class loader to use,
or null to suggest the default class loader
|
---|
Specify the resolution strategy for expressions in bean definition values.
There is no expression support active in a BeanFactory by default. An ApplicationContext will typically set a standard expression strategy here, supporting "#{...}" expressions in a Unified EL compatible style.
Set whether to cache bean metadata such as given bean definitions (in merged fashion) and resolved bean classes. Default is on.
Turn this flag off to enable hot-refreshing of bean definition objects and in particular bean classes. If this flag is off, any creation of a bean instance will re-query the bean class loader for newly resolved classes.
Specify a Spring 3.0 ConversionService to use for converting property values, as an alternative to JavaBeans PropertyEditors.
Set the parent of this bean factory.
Note that the parent cannot be changed: It should only be set outside a constructor if it isn't available at the time of factory instantiation.
parentBeanFactory | the parent BeanFactory |
---|
Set the security context provider for this bean factory. If a security manager is set, interaction with the user code will be executed using the privileged of the provided security context.
Specify a temporary ClassLoader to use for type matching purposes. Default is none, simply using the standard bean ClassLoader.
A temporary ClassLoader is usually just specified if load-time weaving is involved, to make sure that actual bean classes are loaded as lazily as possible. The temporary loader is then removed once the BeanFactory completes its bootstrap phase.
Set a custom type converter that this BeanFactory should use for converting bean property values, constructor argument values, etc.
This will override the default PropertyEditor mechanism and hence make any custom editors or custom editor registrars irrelevant.
Callback after prototype creation.
The default implementation marks the prototype as not in creation anymore.
beanName | the name of the prototype that has been created |
---|
Callback before prototype creation.
The default implementation register the prototype as currently in creation.
beanName | the name of the prototype about to be created |
---|
Check the given merged bean definition, potentially throwing validation exceptions.
mbd | the merged bean definition to check |
---|---|
beanName | the name of the bean |
args | the arguments for bean creation, if any |
BeanDefinitionStoreException | in case of validation failure |
---|
Remove the merged bean definition for the specified bean, recreating it on next access.
beanName | the bean name to clear the merged definition for |
---|
Check if this bean factory contains a bean definition with the given name.
Does not consider any hierarchy this factory may participate in.
Invoked by containsBean
when no cached singleton instance is found.
Depending on the nature of the concrete bean factory implementation, this operation might be expensive (for example, because of directory lookups in external registries). However, for listable bean factories, this usually just amounts to a local hash lookup: The operation is therefore part of the public interface there. The same implementation can serve for both this template method and the public interface method in that case.
beanName | the name of the bean to look for |
---|
Create a bean instance for the given bean definition. The bean definition will already have been merged with the parent definition in case of a child definition.
All the other methods in this class invoke this method, although beans may be cached after being instantiated by this method. All bean instantiation within this class is performed by this method.
beanName | the name of the bean |
---|---|
mbd | the merged bean definition for the bean |
args | arguments to use if creating a prototype using explicit arguments to a
static factory method. This parameter must be null except in this case. |
BeanCreationException | if the bean could not be created |
---|
Destroy the given bean instance (usually a prototype instance obtained from this factory) according to the given bean definition.
beanName | the name of the bean definition |
---|---|
beanInstance | the bean instance to destroy |
mbd | the merged bean definition |
Return an instance, which may be shared or independent, of the specified bean.
name | the name of the bean to retrieve |
---|---|
requiredType | the required type of the bean to retrieve |
args | arguments to use if creating a prototype using explicit arguments to a static factory method. It is invalid to use a non-null args value in any other case. |
typeCheckOnly | whether the instance is obtained for a type check, not for actual use |
BeansException | if the bean could not be created |
---|
Evaluate the given String as contained in a bean definition, potentially resolving it as an expression.
value | the value to check |
---|---|
beanDefinition | the bean definition that the value comes from |
Return the bean definition for the given bean name. Subclasses should normally implement caching, as this method is invoked by this class every time bean definition metadata is needed.
Depending on the nature of the concrete bean factory implementation, this operation might be expensive (for example, because of directory lookups in external registries). However, for listable bean factories, this usually just amounts to a local hash lookup: The operation is therefore part of the public interface there. The same implementation can serve for both this template method and the public interface method in that case.
beanName | the name of the bean to find a definition for |
---|
null
)NoSuchBeanDefinitionException | if the bean definition cannot be resolved |
---|---|
BeansException | in case of errors |
Return the custom TypeConverter to use, if any.
null
if none specified
Return a RootBeanDefinition for the given top-level bean, by merging with the parent if the given bean's definition is a child bean definition.
beanName | the name of the bean definition |
---|---|
bd | the original bean definition (Root/ChildBeanDefinition) |
BeanDefinitionStoreException | in case of an invalid bean definition |
---|
Return a RootBeanDefinition for the given bean, by merging with the parent if the given bean's definition is a child bean definition.
beanName | the name of the bean definition |
---|---|
bd | the original bean definition (Root/ChildBeanDefinition) |
containingBd | the containing bean definition in case of inner bean,
or null in case of a top-level bean |
BeanDefinitionStoreException | in case of an invalid bean definition |
---|
Return a merged RootBeanDefinition, traversing the parent bean definition if the specified bean corresponds to a child bean definition.
beanName | the name of the bean to retrieve the merged definition for |
---|
NoSuchBeanDefinitionException | if there is no bean with the given name |
---|---|
BeanDefinitionStoreException | in case of an invalid bean definition |
BeansException |
Get the object for the given bean instance, either the bean instance itself or its created object in case of a FactoryBean.
beanInstance | the shared bean instance |
---|---|
name | name that may include factory dereference prefix |
beanName | the canonical bean name |
mbd | the merged bean definition |
Determine the bean type for the given FactoryBean definition, as far as possible. Only called if there is no singleton instance registered for the target bean already.
The default implementation creates the FactoryBean via getBean
to call its getObjectType
method. Subclasses are encouraged to optimize
this, typically by just instantiating the FactoryBean but not populating it yet,
trying whether its getObjectType
method already returns a type.
If no type found, a full FactoryBean creation as performed by this implementation
should be used as fallback.
beanName | the name of the bean |
---|---|
mbd | the merged bean definition for the bean |
null
elseReturn whether this factory holds a DestructionAwareBeanPostProcessor that will get applied to singleton beans on shutdown.
Return whether this factory holds a InstantiationAwareBeanPostProcessor that will get applied to singleton beans on shutdown.
Initialize the given BeanWrapper with the custom editors registered with this factory. To be called for BeanWrappers that will create and populate bean instances.
The default implementation delegates to registerCustomEditors(PropertyEditorRegistry)
.
Can be overridden in subclasses.
bw | the BeanWrapper to initialize |
---|
Determine whether the specified bean is eligible for having its bean definition metadata cached.
beanName | the name of the bean |
---|
true
if the bean's metadata may be cached
at this point already
Check whether the given bean is defined as a FactoryBean
.
beanName | the name of the bean |
---|---|
mbd | the corresponding bean definition |
Return whether the specified prototype bean is currently in creation (within the current thread).
beanName | the name of the bean |
---|
Mark the specified bean as already created (or about to be created).
This allows the bean factory to optimize its caching for repeated creation of the specified bean.
beanName | the name of the bean |
---|
Determine the original bean name, resolving locally defined aliases to canonical names.
name | the user-specified name |
---|
Predict the eventual bean type (of the processed bean instance) for the
specified bean. Called by getType(String)
and isTypeMatch(String, Class)
.
Does not need to handle FactoryBeans specifically, since it is only
supposed to operate on the raw bean type.
This implementation is simplistic in that it is not able to handle factory methods and InstantiationAwareBeanPostProcessors. It only predicts the bean type correctly for a standard bean. To be overridden in subclasses, applying more sophisticated type detection.
beanName | the name of the bean |
---|---|
mbd | the merged bean definition to determine the type for |
typesToMatch | the types to match in case of internal type matching purposes
(also signals that the returned Class will never be exposed to application code) |
null
if not predictable
Initialize the given PropertyEditorRegistry with the custom editors that have been registered with this BeanFactory.
To be called for BeanWrappers that will create and populate bean instances, and for SimpleTypeConverter used for constructor argument and factory method type conversion.
registry | the PropertyEditorRegistry to initialize |
---|
Add the given bean to the list of disposable beans in this factory, registering its DisposableBean interface and/or the given destroy method to be called on factory shutdown (if applicable). Only applies to singletons.
beanName | the name of the bean |
---|---|
bean | the bean instance |
mbd | the bean definition for the bean |
Remove the singleton instance (if any) for the given bean name, but only if it hasn't been used for other purposes than type checking.
beanName | the name of the bean |
---|
true
if actually removed, false
otherwise
Determine whether the given bean requires destruction on shutdown.
The default implementation checks the DisposableBean interface as well as a specified destroy method and registered DestructionAwareBeanPostProcessors.
bean | the bean instance to check |
---|---|
mbd | the corresponding bean definition |
Resolve the bean class for the specified bean definition, resolving a bean class name into a Class reference (if necessary) and storing the resolved Class in the bean definition for further use.
mbd | the merged bean definition to determine the class for |
---|---|
beanName | the name of the bean (for error handling purposes) |
typesToMatch | the types to match in case of internal type matching purposes
(also signals that the returned Class will never be exposed to application code) |
null
if none)CannotLoadBeanClassException | if we failed to load the class |
---|
Return the bean name, stripping out the factory dereference prefix if necessary, and resolving aliases to canonical names.
name | the user-specified name |
---|