|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.beans.factory.support.AbstractBeanFactory
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
org.springframework.beans.factory.support.DefaultListableBeanFactory
Concrete implementation of ListableBeanFactory. Can be used as a standalone bean factory, or as a superclass for custom bean factories.
Field Summary |
Fields inherited from class org.springframework.beans.factory.support.AbstractBeanFactory |
FACTORY_BEAN_PREFIX, logger |
Fields inherited from interface org.springframework.beans.factory.config.AutowireCapableBeanFactory |
AUTOWIRE_AUTODETECT, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR |
Constructor Summary | |
DefaultListableBeanFactory()
Create a new DefaultListableBeanFactory. |
|
DefaultListableBeanFactory(BeanFactory parentBeanFactory)
Create a new DefaultListableBeanFactory with the given parent. |
Method Summary | |
boolean |
containsBeanDefinition(java.lang.String name)
Check if this registry contains a bean definition with the given name. |
protected java.util.Map |
findMatchingBeans(java.lang.Class requiredType)
Find bean instances that match the required type. |
BeanDefinition |
getBeanDefinition(java.lang.String beanName)
Return the BeanDefinition for the given bean name. |
int |
getBeanDefinitionCount()
Return the number of beans defined in the registry. |
java.lang.String[] |
getBeanDefinitionNames()
Return the names of all beans defined in this registry. |
java.lang.String[] |
getBeanDefinitionNames(java.lang.Class type)
Note that this method is slow. |
java.util.Map |
getBeansOfType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
Return the bean instances that match the given object type (including subclasses), judging from either bean definitions or the value of getObjectType() in the case of FactoryBeans. |
protected java.lang.String[] |
getDependingBeanNames(java.lang.String beanName)
Return the names of the beans that depend on the given bean. |
void |
preInstantiateSingletons()
Ensure that all non-lazy-init singletons are instantiated, also considering FactoryBeans. |
void |
registerBeanDefinition(java.lang.String name,
BeanDefinition beanDefinition)
Register a new bean definition with this registry. |
void |
setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding)
Set if it should be allowed to override bean definitions by registering a different definition with the same name, automatically replacing the former. |
java.lang.String |
toString()
|
Methods inherited from class org.springframework.beans.factory.support.AbstractBeanFactory |
addBeanPostProcessor, addSingleton, containsBean, destroySingleton, getAliases, getBean, getBean, getBeanPostProcessors, getCustomEditors, getIgnoredDependencyTypes, getMergedBeanDefinition, getMergedBeanDefinition, getObjectForSharedInstance, getParentBeanFactory, getSingletonNames, ignoreDependencyType, initBeanWrapper, isFactoryDereference, isSingleton, registerAlias, registerCustomEditor, registerSingleton, removeSingleton, setParentBeanFactory, transformedBeanName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.beans.factory.BeanFactory |
containsBean, getAliases, getBean, getBean, isSingleton |
Methods inherited from interface org.springframework.beans.factory.config.ConfigurableBeanFactory |
addBeanPostProcessor, destroySingletons, ignoreDependencyType, registerAlias, registerCustomEditor, registerSingleton, setParentBeanFactory |
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory |
getParentBeanFactory |
Methods inherited from interface org.springframework.beans.factory.config.AutowireCapableBeanFactory |
applyBeanPostProcessorsAfterInitialization, applyBeanPostProcessorsBeforeInitialization, autowire, autowireBeanProperties |
Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry |
getAliases, registerAlias |
Constructor Detail |
public DefaultListableBeanFactory()
public DefaultListableBeanFactory(BeanFactory parentBeanFactory)
Method Detail |
public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding)
public int getBeanDefinitionCount()
BeanDefinitionRegistry
getBeanDefinitionCount
in interface ListableBeanFactory
public java.lang.String[] getBeanDefinitionNames()
BeanDefinitionRegistry
getBeanDefinitionNames
in interface ListableBeanFactory
public java.lang.String[] getBeanDefinitionNames(java.lang.Class type)
getBeanDefinitionNames
in interface ListableBeanFactory
type
- class or interface to match, or null for all bean names
public boolean containsBeanDefinition(java.lang.String name)
BeanDefinitionRegistry
containsBeanDefinition
in interface ListableBeanFactory
containsBeanDefinition
in class AbstractBeanFactory
name
- the name of the bean to look for
AbstractBeanFactory.containsBean(java.lang.String)
public java.util.Map getBeansOfType(java.lang.Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException
ListableBeanFactory
If FactoryBean's getObjectType() returns null and the bean is a singleton, the type of the actually created objects should be evaluated. Prototypes without explicit object type specification should be ignored.
Note: Does not ignore singleton beans that have been registered by other means than bean definitions.
getBeansOfType
in interface ListableBeanFactory
type
- class or interface to matchincludePrototypes
- whether to include prototype beans too
or just singletons (also applies to FactoryBeans)includeFactoryBeans
- whether to include FactoryBeans too
or just normal beans
BeansException
- if the beans could not be createdFactoryBean.getObjectType()
public void preInstantiateSingletons() throws BeansException
ConfigurableListableBeanFactory
As this is a startup method, it should destroy already created singletons if it fails, to avoid dangling resources. In other words, after invocation of that method, either all or no singletons at all should be instantiated.
preInstantiateSingletons
in interface ConfigurableListableBeanFactory
BeansException
- if one of the singleton beans could not be createdpublic void registerBeanDefinition(java.lang.String name, BeanDefinition beanDefinition) throws BeanDefinitionStoreException
BeanDefinitionRegistry
registerBeanDefinition
in interface BeanDefinitionRegistry
name
- the name of the bean instance to registerbeanDefinition
- definition of the bean instance to register
BeanDefinitionStoreException
RootBeanDefinition
,
ChildBeanDefinition
public BeanDefinition getBeanDefinition(java.lang.String beanName) throws BeansException
BeanDefinitionRegistry
getBeanDefinition
in interface ConfigurableBeanFactory
getBeanDefinition
in class AbstractBeanFactory
beanName
- name of the bean to find a definition for
BeansException
- in case of errorsRootBeanDefinition
,
ChildBeanDefinition
protected java.lang.String[] getDependingBeanNames(java.lang.String beanName) throws BeansException
AbstractAutowireCapableBeanFactory
getDependingBeanNames
in class AbstractAutowireCapableBeanFactory
beanName
- name of the bean to find depending beans for
BeansException
- in case of errorsAbstractAutowireCapableBeanFactory.destroyBean(java.lang.String, java.lang.Object)
protected java.util.Map findMatchingBeans(java.lang.Class requiredType)
AbstractAutowireCapableBeanFactory
findMatchingBeans
in class AbstractAutowireCapableBeanFactory
requiredType
- the type of the beans to look up
AbstractAutowireCapableBeanFactory.autowireByType(java.lang.String, org.springframework.beans.factory.support.RootBeanDefinition, org.springframework.beans.BeanWrapper, org.springframework.beans.MutablePropertyValues)
,
AbstractAutowireCapableBeanFactory.autowireConstructor(java.lang.String, org.springframework.beans.factory.support.RootBeanDefinition)
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |