Class BeanFactoryUtils

java.lang.Object
io.microsphere.util.BaseUtils
io.microsphere.spring.beans.factory.BeanFactoryUtils

public abstract class BeanFactoryUtils extends io.microsphere.util.BaseUtils
BeanFactory Utilities class
Since:
1.0.0
Author:
Mercy
  • Constructor Details

    • BeanFactoryUtils

      public BeanFactoryUtils()
  • Method Details

    • getOptionalBean

      public static <T> T getOptionalBean(org.springframework.beans.factory.ListableBeanFactory beanFactory, String beanName, Class<T> beanType)
      Get optional Bean
      Type Parameters:
      T - the type of Bean
      Parameters:
      beanFactory - ListableBeanFactory
      beanName - the name of Bean
      beanType - the type of Bean
      Returns:
      A bean if present , or null
    • getBeans

      public static <T> List<T> getBeans(org.springframework.beans.factory.ListableBeanFactory beanFactory, String[] beanNames, Class<T> beanType)
      Gets name-matched Beans from BeanFactory
      Type Parameters:
      T - the type of Bean
      Parameters:
      beanFactory - BeanFactory
      beanNames - the names of Bean
      beanType - the type of Bean
      Returns:
      the read-only and non-null List of Bean names
    • isDefaultListableBeanFactory

      public static boolean isDefaultListableBeanFactory(Object beanFactory)
      Is the given BeanFactory DefaultListableBeanFactory
      Parameters:
      beanFactory - BeanFactory
      Returns:
      true if it's DefaultListableBeanFactory, false otherwise
    • isBeanDefinitionRegistry

      public static boolean isBeanDefinitionRegistry(Object beanFactory)
    • asBeanDefinitionRegistry

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

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

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

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

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

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

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

      public static Set<Class<?>> getResolvableDependencyTypes(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Get the registered Resolvable Dependency Types
      Parameters:
      beanFactory - ConfigurableListableBeanFactory
      Returns:
      non-null read-only Set
    • getResolvableDependencyTypes

      public static Set<Class<?>> getResolvableDependencyTypes(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
      Get the registered Resolvable Dependency Types
      Parameters:
      beanFactory - DefaultListableBeanFactory
      Returns:
      non-null read-only Set
    • getBeanPostProcessors

      public static List<org.springframework.beans.factory.config.BeanPostProcessor> getBeanPostProcessors(@Nullable org.springframework.beans.factory.BeanFactory beanFactory)
      Get all instances of BeanPostProcessor in the specified BeanFactory
      Parameters:
      beanFactory - BeanFactory
      Returns:
      non-null List