org.springframework.beans.factory.config
Interface ConfigurableBeanFactory

All Superinterfaces:
BeanFactory, HierarchicalBeanFactory
All Known Subinterfaces:
ConfigurableListableBeanFactory
All Known Implementing Classes:
AbstractBeanFactory, DefaultListableBeanFactory

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.

Since:
03.11.2003
Version:
$Id: ConfigurableBeanFactory.java,v 1.11 2004/03/19 17:45:35 jhoeller Exp $
Author:
Juergen Hoeller
See Also:
ConfigurableListableBeanFactory

Method Summary
 void addBeanPostProcessor(BeanPostProcessor beanPostProcessor)
          Add a new BeanPostPrcoessor that will get applied to beans created with this factory.
 void destroySingletons()
          Destroy all cached singletons in this factory.
 BeanDefinition getBeanDefinition(java.lang.String beanName)
          Return the registered BeanDefinition for the given bean.
 void ignoreDependencyType(java.lang.Class type)
          Ignore the given dependency type for autowiring.
 void registerAlias(java.lang.String beanName, java.lang.String alias)
          Given a bean name, create an alias.
 void registerCustomEditor(java.lang.Class requiredType, java.beans.PropertyEditor propertyEditor)
          Register the given custom property editor for all properties of the given type.
 void registerSingleton(java.lang.String beanName, java.lang.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, isSingleton
 

Method Detail

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

registerCustomEditor

public void registerCustomEditor(java.lang.Class requiredType,
                                 java.beans.PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type. To be invoked during factory configuration.

Parameters:
requiredType - type of the property
propertyEditor - editor to register

addBeanPostProcessor

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


ignoreDependencyType

public void ignoreDependencyType(java.lang.Class type)
Ignore the given dependency type for autowiring. To be invoked during factory configuration.

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

getBeanDefinition

public BeanDefinition getBeanDefinition(java.lang.String beanName)
                                 throws BeansException
Return the registered BeanDefinition for the given bean.

Parameters:
beanName - name of the bean
Returns:
the registered BeanDefinition
Throws:
NoSuchBeanDefinitionException - if there is no bean with the given name
BeansException - in case of errors

registerAlias

public void registerAlias(java.lang.String beanName,
                          java.lang.String alias)
                   throws 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).

Typically invoked during factory configuration, but can also be used for runtime registration of aliases. Therefore, a factory implementation should synchronize alias access.

Parameters:
beanName - name of the bean
alias - alias that will behave the same as the bean name
Throws:
NoSuchBeanDefinitionException - if there is no bean with the given name
BeansException - if the alias is already in use

registerSingleton

public void registerSingleton(java.lang.String beanName,
                              java.lang.Object singletonObject)
                       throws BeansException
Register the given existing object as singleton in the bean factory, under the given bean name.

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.

Parameters:
beanName - name of the bean
singletonObject - the existing object
Throws:
BeansException - if the singleton could not be registered

destroySingletons

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



Copyright (C) 2003-2004 The Spring Framework Project.