org.springframework.beans.factory.config.ConfigurableBeanFactory |
Known Indirect Subclasses |
Configuration interface to be implemented by most bean factories. Provides
facilities to configure a bean factory, in addition to the bean factory
client methods in the BeanFactory
interface.
This bean factory interface is not meant to be used in normal application
code: Stick to BeanFactory
or
ListableBeanFactory
for typical
needs. This extended interface is just meant to allow for framework-internal
plug'n'play and for special access to bean factory configuration methods.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | SCOPE_PROTOTYPE | Scope identifier for the standard prototype scope: "prototype". | |||||||||
String | SCOPE_SINGLETON | Scope identifier for the standard singleton scope: "singleton". |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.beans.factory.BeanFactory
|
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.
| |||||||||||
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.
| |||||||||||
Destroy all singleton beans in this factory, including inner beans that have
been registered as disposable.
| |||||||||||
Provides a security access control context relevant to this factory.
| |||||||||||
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 associated ConversionService, if any.
| |||||||||||
Return the names of all beans that the specified bean depends on, if any.
| |||||||||||
Return the names of all beans which depend on the specified bean, if any.
| |||||||||||
Return a merged BeanDefinition for the given bean name,
merging a child bean definition with its parent if necessary.
| |||||||||||
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.
| |||||||||||
Obtain a type converter as used by this BeanFactory.
| |||||||||||
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.
| |||||||||||
Given a bean name, create an alias.
| |||||||||||
Register the given custom property editor for all properties of the
given type.
| |||||||||||
Register a dependent bean for the given bean,
to be destroyed before the given bean is destroyed.
| |||||||||||
Register the given scope, backed by the given Scope implementation.
| |||||||||||
Resolve all alias target names and aliases registered in this
factory, applying the given StringValueResolver to them.
| |||||||||||
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.
| |||||||||||
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.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.beans.factory.BeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.HierarchicalBeanFactory
| |||||||||||
From interface
org.springframework.beans.factory.config.SingletonBeanRegistry
|
Scope identifier for the standard prototype scope: "prototype".
Custom scopes can be added via registerScope
.
Scope identifier for the standard singleton scope: "singleton".
Custom scopes can be added via registerScope
.
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 |
---|
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 |
---|
Destroy all singleton beans in this factory, including inner beans that have been registered as disposable. To be called on shutdown of a factory.
Any exception that arises during destruction should be caught and logged instead of propagated to the caller of this method.
Provides a security access control context relevant to this factory.
null
)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 associated ConversionService, if any.
Return the names of all beans that the specified bean depends on, if any.
beanName | the name of the bean |
---|
Return the names of all beans which depend on the specified bean, if any.
beanName | the name of the bean |
---|
Return a merged BeanDefinition for the given bean name, merging a child bean definition with its parent if necessary. Considers bean definitions in ancestor factories as well.
beanName | the name of the bean to retrieve the merged definition for |
---|
NoSuchBeanDefinitionException | if there is no bean definition with the given name |
---|
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.
Obtain 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.
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)NoSuchBeanDefinitionException | if there is no bean with the given name |
---|
Given a bean name, create an alias. We typically use this method to support names that are illegal within XML ids (used for bean names).
Typically invoked during factory configuration, but can also be used for runtime registration of aliases. Therefore, a factory implementation should synchronize alias access.
beanName | the canonical name of the target bean |
---|---|
alias | the alias to be registered for the bean |
BeanDefinitionStoreException | if the alias is already in use |
---|
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 a dependent bean for the given bean, to be destroyed before the given bean is destroyed.
beanName | the name of the bean |
---|---|
dependentBeanName | the name of the dependent bean |
Register the given scope, backed by the given Scope implementation.
scopeName | the scope identifier |
---|---|
scope | the backing Scope implementation |
Resolve all alias target names and aliases registered in this factory, applying the given StringValueResolver to them.
The value resolver may for example resolve placeholders in target bean names and even in alias names.
valueResolver | the StringValueResolver to apply |
---|
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 |
---|
IllegalStateException | if this factory is already associated with a parent BeanFactory |
---|
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.