|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.BeanFactoryUtils
Convenience methods operating on bean factories, returning bean instances, names or counts taking into account the nesting hierarchy of a bean factory.
Constructor Summary | |
BeanFactoryUtils()
|
Method Summary | |
static java.lang.String[] |
beanNamesIncludingAncestors(ListableBeanFactory lbf)
Return all bean names in the factory, including ancestor factories. |
static java.lang.String[] |
beanNamesIncludingAncestors(ListableBeanFactory lbf,
java.lang.Class type)
Get all bean names for the given type, including those defined in ancestor factories. |
static java.lang.Object |
beanOfType(ListableBeanFactory lbf,
java.lang.Class type)
Return a single bean of the given type or subtypes, not looking in ancestor factories. |
static java.lang.Object |
beanOfType(ListableBeanFactory lbf,
java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
Return a single bean of the given type or subtypes, not looking in ancestor factories. |
static java.lang.Object |
beanOfTypeIncludingAncestors(ListableBeanFactory lbf,
java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. |
static java.util.Map |
beansOfTypeIncludingAncestors(ListableBeanFactory lbf,
java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. |
static int |
countBeansIncludingAncestors(ListableBeanFactory lbf)
Count all bean definitions in any hierarchy in which this factory participates. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BeanFactoryUtils()
Method Detail |
public static int countBeansIncludingAncestors(ListableBeanFactory lbf)
lbf
-
public static java.lang.String[] beanNamesIncludingAncestors(ListableBeanFactory lbf)
lbf
- the bean factory
public static java.lang.String[] beanNamesIncludingAncestors(ListableBeanFactory lbf, java.lang.Class type)
lbf
- ListableBeanFactory. If this isn't also a HierarchicalBeanFactory,
this method will return the same as it's own getBeanDefinitionNames() method.type
- the type that beans must match
public static java.util.Map beansOfTypeIncludingAncestors(ListableBeanFactory lbf, java.lang.Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException
lbf
- the bean factorytype
- type of bean 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 createdpublic static java.lang.Object beanOfTypeIncludingAncestors(ListableBeanFactory lbf, java.lang.Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException
lbf
- the bean factorytype
- type of bean 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
NoSuchBeanDefinitionException
- if 0 or more than 1 beans of the given type were found
BeansException
- if the bean could not be createdpublic static java.lang.Object beanOfType(ListableBeanFactory lbf, java.lang.Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException
lbf
- the bean factorytype
- type of bean 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
NoSuchBeanDefinitionException
- if 0 or more than 1 beans of the given type were found
BeansException
- if the bean could not be createdpublic static java.lang.Object beanOfType(ListableBeanFactory lbf, java.lang.Class type) throws BeansException
lbf
- the bean factorytype
- type of bean to match
NoSuchBeanDefinitionException
- if 0 or more than 1 beans of the given type were found
BeansException
- if the bean could not be created
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |