Guice 3.0でデフォルトのバインディングを宣言する方法はありますか?
これが私が期待したものの例です:
//Constructor for Class Impl1
@Inject
public Impl1 (@One IMyOwn own)
{
...
}
//Constructor for Class Impl2
@Inject
public Impl2 (@Two IMyOwn own)
{
...
}
//Declare a default binding
bind(IMyOwn.class).to(DefaultMyOwn.class);
//Then, if I want to bind a custom implementation for @Two
bind(IMyOwn.class).annotatedWith(Two.class).to(TwoMyOwn.class);
実際、すべてのアノテーション(@ One、@ Two)のバインディングを宣言する必要があるため、この例は機能しません。
Guiceでそれを行うための解決策はありますか?ありがとう。