'Guice inject resolution with multiple implementation to type
i have a situation where there two bindings with two different annotations for a type available
bind(MyType.class).annotatedWith(X.class).toInstance(XMyTypeImpl.class) bind(MyType.class).annotatedWith(Y.class).toInstance(YMyTypeImpl.class)
I have another class which has dependency on MyType @Inject public Upstream(MyType myType) {}
without having annotation inside Upstream class, is it possible to get one of implementations of MyType.class get injected?
During bind, can i suggest to guice one of them is default for injection ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
