Interface ManagedBeanRegistry

All Superinterfaces:
Serializable, Service

@SPI(USE) public interface ManagedBeanRegistry extends Service
A registry for ManagedBean instances. Responsible for managing the lifecycle. Integrations obtain and use this service to acquire and release bean handles.

Access to the beans and usage of them are only valid between the time the registry is initialized and released (however those events are recognized).

  • Method Details

    • getBeanContainer

      @Nonnull BeanContainer getBeanContainer()
      Get a reference to the underlying BeanContainer.
    • getBean

      <T> ManagedBean<T> getBean(Class<T> beanClass)
      Get a bean reference by class.
    • getBean

      <T> ManagedBean<? extends T> getBean(String beanName, Class<T> beanContract)
      Get a bean reference by name and contract.
    • getBean

      <T> ManagedBean<T> getBean(Class<T> beanClass, BeanInstanceProducer fallbackBeanInstanceProducer)
      Get a bean reference by class with an explicit fallback bean instance producer.
    • getBean

      <T> ManagedBean<? extends T> getBean(String beanName, Class<T> beanContract, BeanInstanceProducer fallbackBeanInstanceProducer)
      Get a bean reference by name and contract with an explicit fallback bean instance producer.
    • getBootstrapSafeBean

      @Incubating(since="8.0", group="bootstrap-safe-beans") <T> ManagedBean<T> getBootstrapSafeBean(Class<T> beanClass)
      Get a bean reference that is safe to acquire during bootstrap.
      Since:
      8.0
    • getBootstrapSafeBean

      @Incubating(since="8.0", group="bootstrap-safe-beans") <T> ManagedBean<T> getBootstrapSafeBean(Class<T> beanClass, BeanInstanceCaching caching)
      Get a bean reference that is safe to acquire during bootstrap, with control over bean instance caching.
      Since:
      8.0
    • getBean

      @Incubating(since="8.0", group="bootstrap-safe-beans") <T> ManagedBean<T> getBean(Class<T> beanClass, BeanInstanceCaching caching)
      Get a bean reference by class, with control over bean instance caching.

      With BeanInstanceCaching.DISALLOW, the caller should invoke releaseBean(ManagedBean) when it has finished using the returned bean. Container shutdown provides fallback cleanup for unreleased beans.

      With BeanInstanceCaching.ALLOW, the returned bean may be shared with other callers and is normally released at container shutdown. Only explicitly release it when all callers have finished using it.

      Since:
      8.0
    • releaseBean

      @Incubating(since="8.0", group="bootstrap-safe-beans") void releaseBean(ManagedBean<?> bean)
      Release and unregister a bean previously obtained from this registry.
      Since:
      8.0