You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that binding multiple instances of the same type is a guice limitation and I need to use types to achieve this but I can't seem to find a combination that works.
This is what I typically do
public class ExportCompositeTransformer {
@Inject
private Export<IdentifierTransformer> permissionLookupExport;
}
...configure()...
bind(ExportCompositeTransformer.class).asEagerSingleton();
bind(export(IdentifierTransformer.class)).toProvider(service(CompositeTransformer.class)
.attributes(names("uri-part=searches.search-id"))
.export());
but I have a bundle that wants to expose two different transformers. I have tried
@Singleton
@Named("composite")
public class ExportCompositeTransformer ...
...configure()...
bind(ExportCompositeTransformer.class).annotatedWith(Names.named("composite")).asEagerSingleton();
bind(export(IdentifierTransformer.class)).annotatedWith(Names.named("composite")).toProvider(service(CompositeTransformer.class)
.attributes(names("uri-part=searches.search-id"))
.export());
In most cases I fail with an error No implementation for ExportCompositeTransformer annotated with @com.google.inject.name.Named(value=composite) was bound.
Any other ideas how I can create multiple Export bindings?
The text was updated successfully, but these errors were encountered:
I understand that binding multiple instances of the same type is a guice limitation and I need to use types to achieve this but I can't seem to find a combination that works.
This is what I typically do
but I have a bundle that wants to expose two different transformers. I have tried
As well as
In most cases I fail with an error
No implementation for ExportCompositeTransformer annotated with @com.google.inject.name.Named(value=composite) was bound.
Any other ideas how I can create multiple Export bindings?
The text was updated successfully, but these errors were encountered: