Spring版本:4.X
public interface ListableBeanFactory extends BeanFactory {
//根据beanName,检查容器是否含有BeanDefinition
boolean containsBeanDefinition(String beanName);
//返回容器含有的BeanDefinition总数
int getBeanDefinitionCount();
//返回容器中所有bean的名字
String[] getBeanDefinitionNames();
//根据类型返回BeanNames
String[] getBeanNamesForType(ResolvableType type);
//根据类型(包括子类)返回BeanNames
String[] getBeanNamesForType(Class<?> type);
/**根据类型(包括子类)返回BeanNames
*includeNonSingletons:false,代表只包含单例;true,代表包含多例、单例
*allowEagerInit:是否懒加载(注意:FactoryBeans都是立即加载)
*/
String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit);
//根据类型(包括子类)返回Map(BeanName,BeanInstance)
<T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException;
/**根据类型(包括子类)返回Map(BeanNames,BeanInstance)
*includeNonSingletons:false,代表只包含单例;true,代表包含多例、单例
*allowEagerInit:是否懒加载(注意:FactoryBeans都是立即加载)
*/
<T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
throws BeansException;
//查找所有使用注解的类,返回BeanNames
String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType);
//根据注解的类型,返回Map(BeanNames,BeanInstance)
Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException;
//根据注解类型和BeanName来查找指定的Bean
<A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
throws NoSuchBeanDefinitionException;
}