类 BeanFactoryUtils


  • public abstract class BeanFactoryUtils
    extends java.lang.Object
    BeanFactory Utilities class
    从以下版本开始:
    1.0.0
    作者:
    Mercy
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static org.springframework.beans.factory.config.AutowireCapableBeanFactory asAutowireCapableBeanFactory​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.support.BeanDefinitionRegistry asBeanDefinitionRegistry​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.config.ConfigurableBeanFactory asConfigurableBeanFactory​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.config.ConfigurableListableBeanFactory asConfigurableListableBeanFactory​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.support.DefaultListableBeanFactory asDefaultListableBeanFactory​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.HierarchicalBeanFactory asHierarchicalBeanFactory​(java.lang.Object beanFactory)  
      static org.springframework.beans.factory.ListableBeanFactory asListableBeanFactory​(java.lang.Object beanFactory)  
      static <T> java.util.List<T> getBeans​(org.springframework.beans.factory.ListableBeanFactory beanFactory, java.lang.String[] beanNames, java.lang.Class<T> beanType)
      Gets name-matched Beans from BeanFactory
      static <T> T getOptionalBean​(org.springframework.beans.factory.ListableBeanFactory beanFactory, java.lang.String beanName, java.lang.Class<T> beanType)
      Get optional Bean
      static java.util.Set<java.lang.Class<?>> getResolvableDependencyTypes​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Get the registered Resolvable Dependency Types
      static java.util.Set<java.lang.Class<?>> getResolvableDependencyTypes​(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
      Get the registered Resolvable Dependency Types
      static boolean isBeanDefinitionRegistry​(java.lang.Object beanFactory)  
      static boolean isDefaultListableBeanFactory​(java.lang.Object beanFactory)
      Is the given BeanFactory DefaultListableBeanFactory
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • BeanFactoryUtils

        public BeanFactoryUtils()
    • 方法详细资料

      • getOptionalBean

        public static <T> T getOptionalBean​(org.springframework.beans.factory.ListableBeanFactory beanFactory,
                                            java.lang.String beanName,
                                            java.lang.Class<T> beanType)
        Get optional Bean
        类型参数:
        T - the type of Bean
        参数:
        beanFactory - ListableBeanFactory
        beanName - the name of Bean
        beanType - the type of Bean
        返回:
        A bean if present , or null
      • getBeans

        public static <T> java.util.List<T> getBeans​(org.springframework.beans.factory.ListableBeanFactory beanFactory,
                                                     java.lang.String[] beanNames,
                                                     java.lang.Class<T> beanType)
        Gets name-matched Beans from BeanFactory
        类型参数:
        T - the type of Bean
        参数:
        beanFactory - BeanFactory
        beanNames - the names of Bean
        beanType - the type of Bean
        返回:
        the read-only and non-null List of Bean names
      • isDefaultListableBeanFactory

        public static boolean isDefaultListableBeanFactory​(java.lang.Object beanFactory)
        Is the given BeanFactory DefaultListableBeanFactory
        参数:
        beanFactory - BeanFactory
        返回:
        true if it's DefaultListableBeanFactory, false otherwise
      • isBeanDefinitionRegistry

        public static boolean isBeanDefinitionRegistry​(java.lang.Object beanFactory)
      • asBeanDefinitionRegistry

        public static org.springframework.beans.factory.support.BeanDefinitionRegistry asBeanDefinitionRegistry​(java.lang.Object beanFactory)
      • asListableBeanFactory

        public static org.springframework.beans.factory.ListableBeanFactory asListableBeanFactory​(java.lang.Object beanFactory)
      • asHierarchicalBeanFactory

        public static org.springframework.beans.factory.HierarchicalBeanFactory asHierarchicalBeanFactory​(java.lang.Object beanFactory)
      • asConfigurableBeanFactory

        public static org.springframework.beans.factory.config.ConfigurableBeanFactory asConfigurableBeanFactory​(java.lang.Object beanFactory)
      • asAutowireCapableBeanFactory

        public static org.springframework.beans.factory.config.AutowireCapableBeanFactory asAutowireCapableBeanFactory​(java.lang.Object beanFactory)
      • asConfigurableListableBeanFactory

        public static org.springframework.beans.factory.config.ConfigurableListableBeanFactory asConfigurableListableBeanFactory​(java.lang.Object beanFactory)
      • asDefaultListableBeanFactory

        public static org.springframework.beans.factory.support.DefaultListableBeanFactory asDefaultListableBeanFactory​(java.lang.Object beanFactory)
      • getResolvableDependencyTypes

        public static java.util.Set<java.lang.Class<?>> getResolvableDependencyTypes​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
        Get the registered Resolvable Dependency Types
        参数:
        beanFactory - ConfigurableListableBeanFactory
        返回:
        non-null read-only Set
      • getResolvableDependencyTypes

        public static java.util.Set<java.lang.Class<?>> getResolvableDependencyTypes​(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
        Get the registered Resolvable Dependency Types
        参数:
        beanFactory - DefaultListableBeanFactory
        返回:
        non-null read-only Set