Interface BeanDefinitionReference<T>

Type Parameters:
T - The bean type
All Superinterfaces:
AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, ArgumentCoercible<T>, BeanContextConditional, BeanInfo<T>, BeanType<T>, QualifiedBeanType<T>
All Known Subinterfaces:
RuntimeBeanDefinition<T>
All Known Implementing Classes:
AbstractInitializableBeanDefinitionReference, AbstractProviderDefinition, ApplicationEventPublisherFactory, BeanProviderDefinition, DisabledBean, InterceptorRegistryBean, JakartaProviderBeanDefinition, JavaxProviderBeanDefinition

@Internal public interface BeanDefinitionReference<T> extends QualifiedBeanType<T>

A bean definition reference provides a reference to a BeanDefinition thus allowing for soft loading of bean definitions without loading the actual types.

This interface implements AnnotationMetadataProvider thus allowing the bean metadata to be introspected safely without loading the class or the annotations themselves.

The actual bean will be loaded upon calling the load() method. Note that consumers of this interface should call isPresent() prior to loading to ensure an error does not occur

The class can also decide whether to abort loading the definition by returning null

This interface extends the BeanType interface which is shared between BeanDefinition and this type. In addition a reference can be enabled or disabled (see BeanContextConditional.isEnabled(BeanContext))

Since:
1.0
Author:
Graeme Rocher
See Also:
  • Method Details

    • getBeanDefinitionName

      String getBeanDefinitionName()
      Returns:
      The class name of the backing BeanDefinition
    • load

      BeanDefinition<T> load()
      Loads the bean definition.
      Returns:
      The loaded component definition or null if it shouldn't be loaded
    • load

      default BeanDefinition<T> load(BeanContext context)
      Loads the bean definition for the current BeanContext.
      Parameters:
      context - The bean context
      Returns:
      The loaded bean definition or null if it shouldn't be loaded
    • isContextScope

      default boolean isContextScope()
      Returns:
      Is this class context scope
    • isPresent

      boolean isPresent()
      Returns:
      Is the underlying bean type present on the classpath
    • isSingleton

      default boolean isSingleton()
      Returns:
      Is this bean a singleton.
      Since:
      2.0
    • isConfigurationProperties

      default boolean isConfigurationProperties()
      Returns:
      Is this bean a configuration properties.
      Since:
      2.0
    • isProxiedBean

      default boolean isProxiedBean()
      Returns whether another bean exists that proxies this bean. In other words this bean is the target of a proxy.
      Returns:
      Is the reference a proxy target.
      Since:
      4.0.0
    • isProxyTarget

      default boolean isProxyTarget()
      Returns:
      Whether this reference is a proxy target.