Dependency Module
The DI module uses Guice as a dependency injection container of the SDK. All service interfaces that are
Service Binding
All Services are bound to their implementations within the configure()
method of the SdkModule
.
New Implementations or Providers can be added here can be registered here.
@Override
protected void configure() {
bindConfigProperties();
bind(CryptoService.class).to(JWECryptoService.class);
bind(CertificateValidator.class).to(KeyValidator.class);
bind(MetadataValidator.class).to(MetadataSubmissionValidator.class);
bind(MetadataService.class).to(MetadataUploadService.class);
bind(Sender.class).to(SubmissionSender.class);
bind(Subscriber.class).to(SubmissionSubscriber.class);
}
The actual injection can be done in three ways via @Inject:
- Parameter Injection
- Constructor Injection
- Getting the Service directly from the DI Container
Application Properties
The sdk can be externally configured via set property keys in sdk-config/sdk.properties
. Those are keys are loaded
on the guice initialization and can be accessed via the @Named
Annotation. See Guice
for further information on the usage.