|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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 subinterface of BeanFactory is not meant to be used in normal application code: Stick to BeanFactory or ListableBeanFactory for typical use cases. This interface is just meant to allow for framework-internal plug'n'play even when needing access to bean factory configuration methods.
BeanFactory,
ListableBeanFactory,
ConfigurableListableBeanFactory| Field Summary |
| Fields inherited from interface org.springframework.beans.factory.BeanFactory |
FACTORY_BEAN_PREFIX |
| Method Summary | |
void |
addBeanPostProcessor(BeanPostProcessor beanPostProcessor)
Add a new BeanPostProcessor that will get applied to beans created by this factory. |
boolean |
containsSingleton(String beanName)
Check if this bean factory contains a singleton instance with the given name. |
void |
destroySingletons()
Destroy all cached singletons in this factory. |
void |
registerAlias(String beanName,
String alias)
Given a bean name, create an alias. |
void |
registerCustomEditor(Class requiredType,
PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type. |
void |
registerSingleton(String beanName,
Object singletonObject)
Register the given existing object as singleton in the bean factory, under the given bean name. |
void |
setParentBeanFactory(BeanFactory parentBeanFactory)
Set the parent of this bean factory. |
| Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory |
getParentBeanFactory |
| Methods inherited from interface org.springframework.beans.factory.BeanFactory |
containsBean, getAliases, getBean, getBean, getType, isSingleton |
| Method Detail |
public void setParentBeanFactory(BeanFactory parentBeanFactory)
Note that the parent shouldn't be changed: It should only be set outside a constructor if it isn't available when an object of this class is created.
parentBeanFactory - the parent bean factory
public void registerCustomEditor(Class requiredType,
PropertyEditor propertyEditor)
requiredType - type of the propertypropertyEditor - editor to registerpublic void addBeanPostProcessor(BeanPostProcessor beanPostProcessor)
beanPostProcessor - the bean processor to register
public void registerAlias(String beanName,
String alias)
throws BeansException
Typically invoked during factory configuration, but can also be used for runtime registration of aliases. Therefore, a factory implementation should synchronize alias access.
beanName - name of the beanalias - alias that will behave the same as the bean name
NoSuchBeanDefinitionException - if there is no bean with the given name
BeansException - if the alias is already in use
public void registerSingleton(String beanName,
Object singletonObject)
throws BeansException
Typically invoked during factory configuration, but can also be used for runtime registration of singletons. Therefore, a factory implementation should synchronize singleton access; it will have to do this anyway if it supports lazy initialization of singletons.
beanName - name of the beansingletonObject - the existing object
BeansException - if the singleton could not be registeredpublic boolean containsSingleton(String beanName)
The main purpose of this method is to check manually registered singletons
(see registerSingleton). Can also be used to check whether a
singleton defined by a bean definition has already been created.
To check whether a bean factory contains a bean definition with a given name,
use ListableBeanFactory's containsBeanDefinition. Calling both
containsBeanDefinition and containsSingleton answers
whether a specific bean factory contains an own bean with the given name.
Use BeanFactory's containsBean for general checks whether the
factory knows about a bean with a given name (whether manually registed singleton
instance or created by bean definition), also checking ancestor factories.
beanName - the name of the bean to look for
registerSingleton(java.lang.String, java.lang.Object),
BeanFactory.containsBean(java.lang.String),
ListableBeanFactory.containsBeanDefinition(java.lang.String)public void destroySingletons()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||