Typical usage is registering all bean definitions first (possibly read
from a bean definition file), before accessing beans. Bean lookup by name
is therefore an inexpensive operation in a local bean definition table,
operating on pre-resolved bean definition metadata objects.

setAllowBeanDefinitionOverriding

Set whether it should be allowed to override bean definitions by registering
a different definition with the same name, automatically replacing the former.
If not, an exception will be thrown. This also applies to overriding aliases.

isAllowBeanDefinitionOverriding

Return whether it should be allowed to override bean definitions by registering
a different definition with the same name, automatically replacing the former.

Since:

4.1.2

setAllowEagerClassLoading

public void setAllowEagerClassLoading(boolean allowEagerClassLoading)

Set whether the factory is allowed to eagerly load bean classes
even for bean definitions that are marked as "lazy-init".

Default is "true". Turn this flag off to suppress class loading
for lazy-init beans unless such a bean is explicitly requested.
In particular, by-type lookups will then simply ignore bean definitions
without resolved class name, instead of loading the bean classes on
demand just to perform a type check.

copyConfigurationFrom

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.

getBean

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

This method goes into ListableBeanFactory by-type lookup territory
but may also be translated into a conventional by-name lookup based on the name
of the given type. For more extensive retrieval operations across sets of beans,
use ListableBeanFactory and/or BeanFactoryUtils.

This method goes into ListableBeanFactory by-type lookup territory
but may also be translated into a conventional by-name lookup based on the name
of the given type. For more extensive retrieval operations across sets of beans,
use ListableBeanFactory and/or BeanFactoryUtils.

requiredType - 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.

containsBeanDefinition

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.

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.

NOTE: This method introspects top-level beans only. It does not
check nested beans which might match the specified type as well.

Does consider objects created by FactoryBeans, which means that FactoryBeans
will get initialized. If the object created by the FactoryBean doesn't match,
the raw FactoryBean itself will be matched against the type.

Does not consider any hierarchy this factory may participate in.
Use BeanFactoryUtils' beanNamesForTypeIncludingAncestors
to include beans in ancestor factories too.

Note: Does not ignore singleton beans that have been registered
by other means than bean definitions.

This version of getBeanNamesForType matches all kinds of beans,
be it singletons, prototypes, or FactoryBeans. In most implementations, the
result will be the same as for getBeanNamesForType(type, true, true).

Bean names returned by this method should always return bean names in the
order of definition in the backend configuration, as far as possible.

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.

NOTE: This method introspects top-level beans only. It does not
check nested beans which might match the specified type as well.

Does consider objects created by FactoryBeans, which means that FactoryBeans
will get initialized. If the object created by the FactoryBean doesn't match,
the raw FactoryBean itself will be matched against the type.

Does not consider any hierarchy this factory may participate in.
Use BeanFactoryUtils' beanNamesForTypeIncludingAncestors
to include beans in ancestor factories too.

Note: Does not ignore singleton beans that have been registered
by other means than bean definitions.

This version of getBeanNamesForType matches all kinds of beans,
be it singletons, prototypes, or FactoryBeans. In most implementations, the
result will be the same as for getBeanNamesForType(type, true, true).

Bean names returned by this method should always return bean names in the
order of definition in the backend configuration, as far as possible.

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.

NOTE: This method introspects top-level beans only. It does not
check nested beans which might match the specified type as well.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set,
which means that FactoryBeans will get initialized. If the object created by the
FactoryBean doesn't match, the raw FactoryBean itself will be matched against the
type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked
(which doesn't require initialization of each FactoryBean).

Does not consider any hierarchy this factory may participate in.
Use BeanFactoryUtils' beanNamesForTypeIncludingAncestors
to include beans in ancestor factories too.

Note: Does not ignore singleton beans that have been registered
by other means than bean definitions.

Bean names returned by this method should always return bean names in the
order of definition in the backend configuration, as far as possible.

includeNonSingletons - whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)

allowEagerInit - 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.

Returns:

the names of beans (or objects created by FactoryBeans) matching
the given object type (including subclasses), or an empty array if none

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.

NOTE: This method introspects top-level beans only. It does not
check nested beans which might match the specified type as well.

Does consider objects created by FactoryBeans, which means that FactoryBeans
will get initialized. If the object created by the FactoryBean doesn't match,
the raw FactoryBean itself will be matched against the type.

Does not consider any hierarchy this factory may participate in.
Use BeanFactoryUtils' beansOfTypeIncludingAncestors
to include beans in ancestor factories too.

Note: Does not ignore singleton beans that have been registered
by other means than bean definitions.

This version of getBeansOfType matches all kinds of beans, be it
singletons, prototypes, or FactoryBeans. In most implementations, the
result will be the same as for getBeansOfType(type, true, true).

The Map returned by this method should always return bean names and
corresponding bean instances in the order of definition in the
backend configuration, as far as possible.

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.

NOTE: This method introspects top-level beans only. It does not
check nested beans which might match the specified type as well.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set,
which means that FactoryBeans will get initialized. If the object created by the
FactoryBean doesn't match, the raw FactoryBean itself will be matched against the
type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked
(which doesn't require initialization of each FactoryBean).

Does not consider any hierarchy this factory may participate in.
Use BeanFactoryUtils' beansOfTypeIncludingAncestors
to include beans in ancestor factories too.

Note: Does not ignore singleton beans that have been registered
by other means than bean definitions.

The Map returned by this method should always return bean names and
corresponding bean instances in the order of definition in the
backend configuration, as far as possible.

type - the class or interface to match, or null for all concrete beans

includeNonSingletons - whether to include prototype or scoped beans too
or just singletons (also applies to FactoryBeans)

allowEagerInit - 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.

Returns:

a Map with the matching beans, containing the bean names as
keys and the corresponding bean instances as values

registerResolvableDependency

Register a special dependency type with corresponding autowired value.

This is intended for factory/context references that are supposed
to be autowirable but are not defined as beans in the factory:
e.g. a dependency of type ApplicationContext resolved to the
ApplicationContext instance that the bean is living in.

Note: There are no such default types registered in a plain BeanFactory,
not even for the BeanFactory interface itself.

dependencyType - the dependency type to register. This will typically
be a base interface such as BeanFactory, with extensions of it resolved
as well if declared as an autowiring dependency (e.g. ListableBeanFactory),
as long as the given value actually implements the extended interface.

autowiredValue - the corresponding autowired value. This may also be an
implementation of the ObjectFactory
interface, which allows for lazy resolution of the actual target value.

getBeanDefinition

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.

clearMetadataCache

Clear the merged bean definition cache, removing entries for beans
which are not considered eligible for full metadata caching yet.

Typically triggered after changes to the original bean definitions,
e.g. after applying a BeanFactoryPostProcessor. Note that metadata
for beans which have already been created at this point will be kept around.

registerSingleton

Register the given existing object as singleton in the bean registry,
under the given bean name.

The given instance is supposed to be fully initialized; the registry
will not perform any initialization callbacks (in particular, it won't
call InitializingBean's afterPropertiesSet method).
The given instance will not receive any destruction callbacks
(like DisposableBean's destroy method) either.

When running within a full BeanFactory: Register a bean definition
instead of an existing instance if your bean is supposed to receive
initialization and/or destruction callbacks.

Typically invoked during registry configuration, but can also be used
for runtime registration of singletons. As a consequence, a registry
implementation should synchronize singleton access; it will have to do
this anyway if it supports a BeanFactory's lazy initialization of singletons.