Class RegisteredBean

java.lang.Object
org.springframework.beans.factory.support.RegisteredBean

public final class RegisteredBean extends Object
A RegisteredBean represents a bean that has been registered with a BeanFactory, but has not necessarily been instantiated. It provides access to the bean factory that contains the bean as well as the bean name. In the case of inner-beans, the bean name may have been generated.
Since:
6.0
Author:
Phillip Webb
  • Method Details

    • of

      public static RegisteredBean of(ConfigurableListableBeanFactory beanFactory, String beanName)
      Create a new RegisteredBean instance for a regular bean.
      Parameters:
      beanFactory - the source bean factory
      beanName - the bean name
      Returns:
      a new RegisteredBean instance
    • ofInnerBean

      public static RegisteredBean ofInnerBean(RegisteredBean parent, BeanDefinitionHolder innerBean)
      Create a new RegisteredBean instance for an inner-bean.
      Parameters:
      parent - the parent of the inner-bean
      innerBean - a BeanDefinitionHolder for the inner bean
      Returns:
      a new RegisteredBean instance
    • ofInnerBean

      public static RegisteredBean ofInnerBean(RegisteredBean parent, BeanDefinition innerBeanDefinition)
      Create a new RegisteredBean instance for an inner-bean.
      Parameters:
      parent - the parent of the inner-bean
      innerBeanDefinition - the inner-bean definition
      Returns:
      a new RegisteredBean instance
    • ofInnerBean

      public static RegisteredBean ofInnerBean(RegisteredBean parent, @Nullable String innerBeanName, BeanDefinition innerBeanDefinition)
      Create a new RegisteredBean instance for an inner-bean.
      Parameters:
      parent - the parent of the inner-bean
      innerBeanName - the name of the inner bean or null to generate a name
      innerBeanDefinition - the inner-bean definition
      Returns:
      a new RegisteredBean instance
    • getBeanName

      public String getBeanName()
      Return the name of the bean.
      Returns:
      the beanName the bean name
    • isGeneratedBeanName

      public boolean isGeneratedBeanName()
      Return if the bean name is generated.
      Returns:
      true if the name was generated
    • getBeanFactory

      public ConfigurableListableBeanFactory getBeanFactory()
      Return the bean factory containing the bean.
      Returns:
      the bean factory
    • getBeanClass

      public Class<?> getBeanClass()
      Return the user-defined class of the bean.
      Returns:
      the bean class
    • getBeanType

      public ResolvableType getBeanType()
      Return the ResolvableType of the bean.
      Returns:
      the bean type
    • getMergedBeanDefinition

      public RootBeanDefinition getMergedBeanDefinition()
      Return the merged bean definition of the bean.
      Returns:
      the merged bean definition
      See Also:
    • isInnerBean

      public boolean isInnerBean()
      Return if this instance is for an inner-bean.
      Returns:
      if an inner-bean
    • getParent

      @Nullable public RegisteredBean getParent()
      Return the parent of this instance or null if not an inner-bean.
      Returns:
      the parent
    • resolveConstructorOrFactoryMethod

      public Executable resolveConstructorOrFactoryMethod()
      Resolve the constructor or factory method to use for this bean.
      Returns:
      the Constructor or Method
    • resolveAutowiredArgument

      @Nullable public Object resolveAutowiredArgument(DependencyDescriptor descriptor, TypeConverter typeConverter, Set<String> autowiredBeans)
      Resolve an autowired argument.
      Parameters:
      descriptor - the descriptor for the dependency (field/method/constructor)
      typeConverter - the TypeConverter to use for populating arrays and collections
      autowiredBeans - a Set that all names of autowired beans (used for resolving the given dependency) are supposed to be added to
      Returns:
      the resolved object, or null if none found
      Since:
      6.0.9
    • toString

      public String toString()
      Overrides:
      toString in class Object