Class SuppliedBean

java.lang.Object
io.avaje.inject.spi.SuppliedBean

public class SuppliedBean extends Object
Holds beans supplied to the dependency injection.

These can be externally supplied dependencies or test doubles for testing purposes.

  • Method Details

    • of

      public static SuppliedBean of(Class<?> type, Object source)
      Create with a class type and bean instance.
    • of

      public static <B> SuppliedBean of(String name, Class<B> type, Consumer<B> consumer)
      Create for a class type with a consumer that runs once when the bean is obtained.
    • of

      public static <B> SuppliedBean of(String name, Class<B> type, B source)
      Create for a class type with name.
    • ofType

      public static SuppliedBean ofType(String name, Type type, Object source)
      Create a supplied bean for a generic type.
    • secondary

      public static SuppliedBean secondary(String name, Type type, Object source)
      Create a supplied bean with SECONDARY priority as a default fallback dependency that is only used when no other matching one is provided.
    • source

      public Object source()
      Return the bean instance or provider to use for injection.
    • priority

      public final int priority()
      Return the associated priority.
    • type

      public final Type type()
      Return the dependency injection target type.
    • name

      public final String name()
      Return the qualifier name of the supplied bean.
    • interfaces

      public final Class<?>[] interfaces()
      Return the interfaces to additionally register along with the type.