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.
The DependencyProvider must be configured using the ServiceSetup.createDependencyProvider() method. This ensures that the correct dependencies are
available to the component implementations at runtime.
-
Method Summary
Modifier and TypeMethodDescription<T> TgetDependency(Class<T> clazz) Get a dependency for a given class.static DependencyProviderCreate a dependency provider that always returns the same instance for a given class.
-
Method Details
-
getDependency
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
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
-