Class SimpleBeanDefinitionRegistry
java.lang.Object
org.springframework.core.SimpleAliasRegistry
org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry
- All Implemented Interfaces:
- BeanDefinitionRegistry,- AliasRegistry
public class SimpleBeanDefinitionRegistry
extends SimpleAliasRegistry
implements BeanDefinitionRegistry
Simple implementation of the 
BeanDefinitionRegistry interface.
 Provides registry capabilities only, with no factory capabilities built in.
 Can for example be used for testing bean definition readers.- Since:
- 2.5.2
- Author:
- Juergen Hoeller
- 
Field SummaryFields inherited from class org.springframework.core.SimpleAliasRegistrylogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontainsBeanDefinition(String beanName) Check if this registry contains a bean definition with the given name.getBeanDefinition(String beanName) Return the BeanDefinition for the given bean name.intReturn the number of beans defined in the registry.String[]Return the names of all beans defined in this registry.booleanisBeanNameInUse(String beanName) Determine whether the given bean name is already in use within this registry, i.e.voidregisterBeanDefinition(String beanName, BeanDefinition beanDefinition) Register a new bean definition with this registry.voidremoveBeanDefinition(String beanName) Remove the BeanDefinition for the given name.Methods inherited from class org.springframework.core.SimpleAliasRegistryallowAliasOverriding, canonicalName, checkForAliasCircle, getAliases, hasAlias, isAlias, registerAlias, removeAlias, resolveAliasesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.AliasRegistrygetAliases, isAlias, registerAlias, removeAliasMethods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistryisBeanDefinitionOverridable
- 
Constructor Details- 
SimpleBeanDefinitionRegistrypublic SimpleBeanDefinitionRegistry()
 
- 
- 
Method Details- 
registerBeanDefinitionpublic void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) throws BeanDefinitionStoreException Description copied from interface:BeanDefinitionRegistryRegister a new bean definition with this registry. Must support RootBeanDefinition and ChildBeanDefinition.- Specified by:
- registerBeanDefinitionin interface- BeanDefinitionRegistry
- Parameters:
- beanName- the name of the bean instance to register
- beanDefinition- definition of the bean instance to register
- Throws:
- BeanDefinitionStoreException- if the BeanDefinition is invalid
- BeanDefinitionOverrideException- if there is already a BeanDefinition for the specified bean name and we are not allowed to override it
- See Also:
 
- 
removeBeanDefinitionDescription copied from interface:BeanDefinitionRegistryRemove the BeanDefinition for the given name.- Specified by:
- removeBeanDefinitionin interface- BeanDefinitionRegistry
- Parameters:
- beanName- the name of the bean instance to register
- Throws:
- NoSuchBeanDefinitionException- if there is no such bean definition
 
- 
getBeanDefinitionDescription copied from interface:BeanDefinitionRegistryReturn the BeanDefinition for the given bean name.- Specified by:
- getBeanDefinitionin interface- BeanDefinitionRegistry
- Parameters:
- beanName- name of the bean to find a definition for
- Returns:
- the BeanDefinition for the given name (never null)
- Throws:
- NoSuchBeanDefinitionException- if there is no such bean definition
 
- 
containsBeanDefinitionDescription copied from interface:BeanDefinitionRegistryCheck if this registry contains a bean definition with the given name.- Specified by:
- containsBeanDefinitionin interface- BeanDefinitionRegistry
- Parameters:
- beanName- the name of the bean to look for
- Returns:
- if this registry contains a bean definition with the given name
 
- 
getBeanDefinitionNamesDescription copied from interface:BeanDefinitionRegistryReturn the names of all beans defined in this registry.- Specified by:
- getBeanDefinitionNamesin interface- BeanDefinitionRegistry
- Returns:
- the names of all beans defined in this registry, or an empty array if none defined
 
- 
getBeanDefinitionCountpublic int getBeanDefinitionCount()Description copied from interface:BeanDefinitionRegistryReturn the number of beans defined in the registry.- Specified by:
- getBeanDefinitionCountin interface- BeanDefinitionRegistry
- Returns:
- the number of beans defined in the registry
 
- 
isBeanNameInUseDescription copied from interface:BeanDefinitionRegistryDetermine whether the given bean name is already in use within this registry, i.e. whether there is a local bean or alias registered under this name.- Specified by:
- isBeanNameInUsein interface- BeanDefinitionRegistry
- Parameters:
- beanName- the name to check
- Returns:
- whether the given bean name is already in use
 
 
-