public interface ListableBeanFactory extends BeanFactory
FACTORY_BEAN_PREFIX| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
containsBeanDefinition(String beanName)
查看是否包含指定名字的Bean
不支持向上或向下查找
不支持查找非配置文件定义的单例Bean
|
<A extends Annotation> |
findAnnotationOnBean(String beanName,
Class<A> annotationType)
在指定name对应的Bean上找指定的注解,如果没有找到的话,去指定Bean的父类或者父接口上查找
|
int |
getBeanDefinitionCount()
获取容器中的所有bean定义
|
String[] |
getBeanDefinitionNames()
查看此BeanFactory中包含的Bean数量
不支持向上或向下查找
不支持查找非配置文件定义的单例Bean
|
String[] |
getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)
找到所有带有指定注解类型的Bean
|
String[] |
getBeanNamesForType(Class<?> type)
返回此BeanFactory中所有指定类型的Bean的名字。
|
String[] |
getBeanNamesForType(Class<?> type,
boolean includeNonSingletons,
boolean allowEagerInit)
返回此BeanFactory中所有指定类型(或指定类型的子类型)的Bean的名字。
|
String[] |
getBeanNamesForType(org.springframework.core.ResolvableType type)
返回此BeanFactory中所包含的所有Bean定义的名称
不支持向上或向下查找
不支持查找非配置文件定义的单例Bean
|
<T> Map<String,T> |
getBeansOfType(Class<T> type)
返回此BeanFactory中所有指定类型(或指定类型的子类型)的Bean的名字。
|
<T> Map<String,T> |
getBeansOfType(Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit)
返回此BeanFactory中所有指定类型(或指定类型的子类型)的Bean的名字。
|
Map<String,Object> |
getBeansWithAnnotation(Class<? extends Annotation> annotationType)
找到所有带有指定注解的Bean,返回一个以Bean的name为键,其对应的Bean实例为值的Map
|
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchboolean containsBeanDefinition(String beanName)
int getBeanDefinitionCount()
String[] getBeanDefinitionNames()
String[] getBeanNamesForType(org.springframework.core.ResolvableType type)
String[] getBeanNamesForType(@Nullable Class<?> type)
String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
<T> Map<String,T> getBeansOfType(@Nullable Class<T> type) throws BeansException
BeansException<T> Map<String,T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException
BeansExceptionString[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)
Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException
BeansException@Nullable <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) throws NoSuchBeanDefinitionException