Class DefaultBeanResolutionContext

java.lang.Object
io.micronaut.context.AbstractBeanResolutionContext
io.micronaut.context.DefaultBeanResolutionContext
All Implemented Interfaces:
BeanResolutionContext, ValueResolver<CharSequence>, AutoCloseable

@Internal public final class DefaultBeanResolutionContext extends AbstractBeanResolutionContext
Default implementation of BeanResolutionContext.
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • DefaultBeanResolutionContext

      public DefaultBeanResolutionContext(BeanContext context, BeanDefinition<?> rootDefinition)
      Parameters:
      context - The bean context
      rootDefinition - The bean root definition
  • Method Details

    • copy

      public BeanResolutionContext copy()
      Description copied from interface: BeanResolutionContext
      Copy current context to be used later.
      Returns:
      The bean resolution context
    • close

      public void close()
    • addInFlightBean

      public <T> void addInFlightBean(BeanIdentifier beanIdentifier, BeanRegistration<T> beanRegistration)
      Description copied from interface: BeanResolutionContext
      Adds a bean that is created as part of the resolution. This is used to store references to instances passed to BeanContext.inject(Object).
      Type Parameters:
      T - The instance type
      Parameters:
      beanIdentifier - The bean identifier
      beanRegistration - The bean registration
    • removeInFlightBean

      public void removeInFlightBean(BeanIdentifier beanIdentifier)
      Description copied from interface: BeanResolutionContext
      Removes a bean that is in the process of being created. This is used to store references to instances passed to BeanContext.inject(Object).
      Parameters:
      beanIdentifier - The bean identifier
    • getInFlightBean

      @Nullable public <T> @Nullable BeanRegistration<T> getInFlightBean(BeanIdentifier beanIdentifier)
      Description copied from interface: BeanResolutionContext
      Obtains an inflight bean for the given identifier. An "In Flight" bean is one that is currently being created but has not finished construction and been registered as a singleton just yet. For example in the case whereby a bean as a PostConstruct method that also triggers bean resolution of the same bean.
      Type Parameters:
      T - The bean type
      Parameters:
      beanIdentifier - The bean identifier
      Returns:
      The bean