Class SpringBeanStore

java.lang.Object
org.apache.juneau.cp.BeanStore
org.apache.juneau.rest.springboot.SpringBeanStore

public class SpringBeanStore extends BeanStore
A bean store that uses Spring bean resolution to find beans if they're not already in this store.
See Also:
  • Constructor Details

    • SpringBeanStore

      public SpringBeanStore(Optional<org.springframework.context.ApplicationContext> appContext, Optional<BeanStore> parent, Object resource)
      Constructor.
      Parameters:
      appContext - The Spring application context used to resolve beans.
      parent - The parent REST object bean store. Can be null.
      resource - The REST object. Can be null.
  • Method Details

    • getBean

      public <T> Optional<T> getBean(Class<T> c)
      Description copied from class: BeanStore
      Returns the unnamed bean of the specified type.
      Overrides:
      getBean in class BeanStore
      Type Parameters:
      T - The type of bean to return.
      Parameters:
      c - The type of bean to return.
      Returns:
      The bean.
    • getBean

      public <T> Optional<T> getBean(Class<T> c, String name)
      Description copied from class: BeanStore
      Returns the named bean of the specified type.
      Overrides:
      getBean in class BeanStore
      Type Parameters:
      T - The type of bean to return.
      Parameters:
      c - The type of bean to return.
      name - The bean name. Can be null.
      Returns:
      The bean.
    • stream

      public <T> Stream<BeanStoreEntry<T>> stream(Class<T> c)
      Description copied from class: BeanStore
      Returns all the beans in this store of the specified type.

      Returns both named and unnamed beans.

      The results from the parent bean store are appended to the list of beans from this beans store.

      Overrides:
      stream in class BeanStore
      Type Parameters:
      T - The bean type to return.
      Parameters:
      c - The bean type to return.
      Returns:
      The bean entries. Never null.