Interface BeanDefinitionService

All Known Implementing Classes:
DefaultBeanDefinitionService

@Internal public sealed interface BeanDefinitionService permits DefaultBeanDefinitionService
The API to access bean definitions and bean references. Internal implementation is responsible for loading bean definitions and checking if it's enabled.
Since:
5.0
Author:
Denis Stepanov
  • Method Details

    • addBeanDefinition

      void addBeanDefinition(@NonNull @NonNull RuntimeBeanDefinition<?> definition)
      Registers a runtime bean definition so it becomes visible to the provider alongside precompiled definitions.
      Parameters:
      definition - the runtime definition to register, never null
    • removeBeanDefinition

      void removeBeanDefinition(@NonNull @NonNull RuntimeBeanDefinition<?> definition)
      Unregisters a runtime bean definition that was previously added.
      Parameters:
      definition - the runtime definition to remove, never null
    • trackDisabled

      void trackDisabled(QualifiedBeanType<?> beanType, List<String> reasons)
      Records that a qualified bean type has been disabled, along with human-readable reasons.
      Parameters:
      beanType - the qualified bean type that has been disabled
      reasons - the reasons explaining why the bean is disabled
    • getEagerInitBeans

      Iterable<BeanDefinition<Object>> getEagerInitBeans(@NonNull @NonNull BeanContext beanContext)
      Returns bean definitions that should be initialized eagerly.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      Returns:
      an iterable of bean definitions that should be eagerly instantiated
    • getProcessedBeans

      Iterable<BeanDefinition<Object>> getProcessedBeans(@NonNull @NonNull BeanContext beanContext)
      Returns bean definitions that require contextual processing during startup.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      Returns:
      an iterable of bean definitions that require processing at startup
    • getParallelBeans

      Iterable<BeanDefinition<Object>> getParallelBeans(@NonNull @NonNull BeanContext beanContext)
      Returns bean definitions that are safe to be instantiated in parallel during startup.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      Returns:
      an iterable of bean definitions eligible for parallel creation
    • getTargetProxyBeans

      Iterable<BeanDefinition<Object>> getTargetProxyBeans(@NonNull @NonNull BeanContext beanContext)
      Returns target proxy bean definitions.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      Returns:
      an iterable of bean definitions that should be treated as target proxy candidates
    • getDisabledBeans

      List<DisabledBean<?>> getDisabledBeans(@NonNull @NonNull BeanContext beanContext)
      Returns a disabled beans.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      Returns:
      a list of disabled beans with their associated reasons
    • exists

      @NonNull @io.micronaut.core.annotation.NonNull boolean exists(Class<?> beanType)
      Returns whether at least one bean definition exists for the given raw type. This is a lightweight existence check and does not consider qualifiers.
      Parameters:
      beanType - the raw type to check
      Returns:
      true if at least one definition of the given type is known; false otherwise
    • getBeanDefinitions

      Resolves enabled bean definitions.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      defPredicate - optional filter applied to definitions
      Returns:
      a list of loaded bean definitions matching the filter
    • getBeanDefinitions

      Resolves enabled bean definitions.
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      refPredicate - optional filter applied to references
      defPredicate - optional filter applied to definitions
      Returns:
      a list of loaded bean definitions matching the filters
    • getBeanDefinitions

      Resolves enabled bean definitions.
      Type Parameters:
      B - the bean generic type
      Parameters:
      beanContext - the bean context to eliminate disabled beans
      beanType - the bean type to resolve
      refPredicate - optional filter applied to references
      defPredicate - optional filter applied to definitions
      Returns:
      an iterable over matching bean definitions; iteration may trigger loading
    • getBeanDefinitions

      Resolves enabled bean definitions.
      Type Parameters:
      B - the bean generic type
      Parameters:
      beanResolutionContext - the resolution context to eliminate disabled beans
      beanType - the bean context to eliminate disabled beans
      refPredicate - optional filter applied to references prior to loading; may be null
      defPredicate - optional filter applied to loaded definitions; may be null
      Returns:
      an iterable over matching bean definitions]]
    • getBeanReferences

      Returns all enabled bean references.
      Parameters:
      beanContext - the context for which references are requested
      Returns:
      an iterable of bean definition references
    • getBeanReferences

      Returns all bean references.
      Returns:
      a list of all known bean definition references
    • registerConfiguration

      void registerConfiguration(@NonNull @NonNull BeanConfiguration configuration)
      Registers a bean configuration.
      Parameters:
      configuration - the configuration to register
    • reset

      void reset()
      Resets the provider by clearing internal caches and runtime registrations. Intended for container lifecycle management and test scenarios.
    • initialize

      void initialize(BeanContext beanContext)
      Initializes the provider for use with the given context. Implementations may perform warm-up and indexing.
      Parameters:
      beanContext - the bean context