How to get guice to provide a unique instance with a provider?

2014-08-24 Thread Maatary Okouya
Hi, I have an object A that does some important loading. I use a provider for it. I have object B that needs A for its initialization. However in an object C I want to pass A, and B, properly prepared. Would it be possible to get a provider to return the same instance all the time, or the

Re: How to get guice to provide a unique instance with a provider?

2014-08-24 Thread Maatary Okouya
*I have the following on the guice website with few explanation:* * @Provides @Singleton* * TransactionLog provideTransactionLog() {* *...* * }* *Is that the solution. Does the singleton apply to the provider or the provided. If it applies to the provider then, the solution would be to

Re: How to inject an interface implementation based on annotations at runtime using Google Guice

2014-08-24 Thread Stephan Classen
Guice does not provide a way to bind conditionally. Any decission which is made at runtime must happen in your code. The only thing which I can think of that might help in this kind of situation are multibindings. Basically multibindings allow to bind many implementations of an interface. All