Hello there,
I trying to implement default binding on my module without any success...
Here is what I would like to do (*my dream*) :
class AFoo
> {
> @Inject AFoo( IFoo foo ){}
> }
>
> class BFoo
> {
> @Inject BFoo( IFoo foo ){}
> }
>
>
> bind(IFoo.class).to(DefaultFoo.class);
> bind(IFoo.class).to(OtherFoo.class)*.on(BFoo.class)*;
>
I know that I could solve this problem using annotation like this :
class AFoo
> {
> @Inject AFoo( @A IFoo foo ){}
> }
>
> class BFoo
> {
> @Inject BFoo( @B IFoo foo ){}
> }
>
>
> bind(IFoo.class).annotatedWith(A.class).to(DefaultFoo.class);
> bind(IFoo.class).annotatedWith(B.class).to(OtherFoo.class);
>
But this way is too boring and dirty.. (because I have to add
annotation/binding definition for each one)
- *Are there some others ways to solve Default binding "problem" ?*
Thanks in advance; Best regards
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/LlnJbaQPI8MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.