org.springframework.beans.factory.config
Interface ConfigurableBeanFactory

All Known Subinterfaces:
ConfigurableListableBeanFactory
All Known Implementing Classes:
AbstractBeanFactory

public interface ConfigurableBeanFactory
extends HierarchicalBeanFactory

SPI interface to be implemented by most if not all bean factories. Provides means to configure a bean factory in addition to the bean factory client methods in the BeanFactory interface.

Allows for framework-internal plug'n'play even when needing access to bean factory configuration methods.

Author:
Juergen Hoeller
Version: $Id: ConfigurableBeanFactory.java,v 1.8 2004/02/04 17:23:45 jhoeller Exp $
Since: 03.11.2003
See Also: ConfigurableListableBeanFactory

Method Summary
 voidaddBeanPostProcessor(BeanPostProcessor beanPostProcessor)
          Add a new BeanPostPrcoessor that will get applied to beans created with this factory.
 voiddestroySingletons()
          Destroy all cached singletons in this factory.
 ConstructorArgumentValuesgetConstructorArgumentValues(String beanName)
          Return the registered ConstructorArgumentValues for the given bean.
 MutablePropertyValuesgetPropertyValues(String beanName)
          Return the registered PropertyValues for the given bean.
 voidignoreDependencyType(Class type)
          Ignore the given dependency type for autowiring.
 voidregisterAlias(String beanName, String alias)
          Given a bean name, create an alias.
 voidregisterCustomEditor(Class requiredType, PropertyEditor propertyEditor)
          Register the given custom property editor for all properties of the given type.
 voidregisterSingleton(String beanName, Object singletonObject)
          Register the given existing object as singleton in the bean factory, under the given bean name.
 voidsetParentBeanFactory(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, isSingleton

Method Detail

addBeanPostProcessor

public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor)
Add a new BeanPostPrcoessor that will get applied to beans created with this factory.

destroySingletons

public void destroySingletons()
Destroy all cached singletons in this factory. To be called on shutdown of a factory.

getConstructorArgumentValues

public ConstructorArgumentValues getConstructorArgumentValues(String beanName)
throws org.springframework.beans.BeansException
Return the registered ConstructorArgumentValues for the given bean.
Parameters:
beanName - name of the bean
Returns: the registered ConstructorArgumentValues
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException if - there is no bean with the given name
BeansException - in case of errors

getPropertyValues

public MutablePropertyValues getPropertyValues(String beanName)
throws org.springframework.beans.BeansException
Return the registered PropertyValues for the given bean.
Parameters:
beanName - name of the bean
Returns: the registered PropertyValues
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException if - there is no bean with the given name
BeansException - in case of errors

ignoreDependencyType

public void ignoreDependencyType(Class type)
Ignore the given dependency type for autowiring.

This will typically be used for dependencies that are resolved in other ways, like BeanFactory through BeanFactoryAware or ApplicationContext through ApplicationContextAware.

See Also:
BeanFactoryAware, ApplicationContextAware

registerAlias

public void registerAlias(String beanName, String alias)
throws org.springframework.beans.BeansException
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).
Parameters:
beanName - name of the bean
alias - alias that will behave the same as the bean name
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException if - there is no bean with the given name
BeansException - if the alias is already in use

registerCustomEditor

public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type.
Parameters:
requiredType - type of the property
propertyEditor - editor to register

registerSingleton

public void registerSingleton(String beanName, Object singletonObject)
throws org.springframework.beans.BeansException
Register the given existing object as singleton in the bean factory, under the given bean name.
Parameters:
beanName - name of the bean
singletonObject - the existing object
Throws:
BeansException - if the singleton could not be registered

setParentBeanFactory

public void setParentBeanFactory(BeanFactory parentBeanFactory)
Set the parent of this bean factory.

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.

Parameters:
parentBeanFactory - the parent bean factory