Package akka.javasdk

Interface DependencyProvider


public interface DependencyProvider
A factory method to provide additional dependencies to the component implementations.

Implementations of this interface must be thread safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    getDependency(Class<T> clazz)
    Get a dependency for a given class.
    single(Object single)
    Create a dependency provider that always returns the same instance for a given class.
  • Method Details

    • getDependency

      <T> T getDependency(Class<T> clazz)
      Get a dependency for a given class. If the dependency is not found, an exception should be thrown.

      Returned instance for a given class must be safe to use concurrently.

      Type Parameters:
      T - The type of the dependency
      Parameters:
      clazz - The class of the dependency to get
      Returns:
      The dependency instance
    • single

      static DependencyProvider single(Object single)
      Create a dependency provider that always returns the same instance for a given class.
      Parameters:
      single - The single instance to return
      Returns:
      The dependency provider