Interface AsyncFactoryBean<T>

All Superinterfaces:
org.springframework.beans.factory.FactoryBean<Future<T>>
All Known Implementing Classes:
AbstractAsyncFactoryBean, HomologeneServiceFactory

public interface AsyncFactoryBean<T> extends org.springframework.beans.factory.FactoryBean<Future<T>>
Async extension of the FactoryBean interface.

Limitation:
Attempting to inject a List<Future<MyService>> will produce unexpected types in the collections if you have defined other subclasses of AsyncFactoryBean for other bean types, there is unfortunately no direct replacement for this, and you will have to filter the beans by type manually by calling BeanFactory.getBean(Class) with the class of Future.

Author:
poirigui
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtain a bean asynchronously.
    boolean
    Indicate if this bean has been initialized or if its initialization is pending.

    Methods inherited from interface org.springframework.beans.factory.FactoryBean

    getObjectType, isSingleton
  • Method Details

    • getObject

      Future<T> getObject()
      Obtain a bean asynchronously.
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<T>
      Returns:
      a future that completes when the bean is ready
    • isInitialized

      boolean isInitialized()
      Indicate if this bean has been initialized or if its initialization is pending.

      This is only meaningful if FactoryBean.isSingleton() is true as otherwise a new, yet to be initialized bean will be returned everytime and this method will always return false.