On 22.01.2012 21:11, Eyal Golan wrote:
I plan it to be a singleton.
It is even dependent on a class that i bind with toInstance (as the frameworks allow me only to use getInstance).

So my question is:
If I have another class that gets injected with the IDataCollector (and another with RecordsCounterOperations) , will Guice know to inject CoreFetchOperationsImpl into each of them it if I do:
bind(CoreFetchOperationsImpl.class)... ?

Aren't I suppose to give as KEY the interface that in the constructor's parameters?
That is correct but the other to bind statements end with .to(CoreFetchOperationsImpl.class) which guice interprets as just another key which you then bind to singleton, thus both keys (i.e. your two interfaces) point to the same key which is a singleton, et voilá two keys, one instance.

Thanks
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
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.

--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
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.

Reply via email to