I have a Gucie Binding setup like this:
MapBinder<String, MyInterface> mapBinder = MapBinder.newMapBinder(binder(), String.class, MyInterface.class);
mapBinder.addBinding("a").to(MyClassA.class);
mapBinder.addBinding("b").to(MyClassB.class);
MyClassA implements MyInterface of course.
Everytime I get query the injected map with a key, it always returns me the same instance:
class UserClass {
private final Map<String, MyInterface> map;
public UserClass(Map<String, MyInterface> map) {
this.map = map;
}
public void MyMethod() {
MyInterface instance1 = map.get("a");
MyInterface instance2 = map.get("a");
.....
}
......
}
Here instance1 and instance2 I got are always the same object. Is there any way to configure Gucie to always returns different instances from MapBinder?
Many thanks