ListableBeanFactory源码解析

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)
     Map getBeansOfType(Class type) throws BeansException;

    /**根据类型(包括子类)返回Map(BeanNames,BeanInstance)
    *includeNonSingletons:false,代表只包含单例;true,代表包含多例、单例
    *allowEagerInit:是否懒加载(注意:FactoryBeans都是立即加载)
    */
     Map getBeansOfType(Class type, boolean includeNonSingletons, boolean allowEagerInit)
            throws BeansException;

    //查找所有使用注解的类,返回BeanNames
    String[] getBeanNamesForAnnotation(Class annotationType);

    //根据注解的类型,返回Map(BeanNames,BeanInstance)
    Map getBeansWithAnnotation(Class annotationType) throws BeansException;

     //根据注解类型和BeanName来查找指定的Bean
     A findAnnotationOnBean(String beanName, Class annotationType)
            throws NoSuchBeanDefinitionException;

}

你可能感兴趣的:(ListableBeanFactory源码解析)