On 10 Jan 2014, at 11:58, Fred Faber <[email protected]> wrote:

> binder.bind(IFoo.class).toProvider<https://google-guice.googlecode.com/git/javadoc/com/google/inject/binder/LinkedBindingBuilder.html#toProvider(com.google.inject.Provider<?
> extends T>)>(myProvider) does this.

and if you have existing javax.inject.Provider instances you can use 
Providers.guicify(myStandardProvider) to convert them to 
com.google.inject.Provider

        
http://google-guice.googlecode.com/git/javadoc/com/google/inject/util/Providers.html

        bind( IFoo.class ).toProvider( Providers.guicify( myStandardProvider ) 
);

> On Fri, Jan 10, 2014 at 4:50 AM, Jochen Wiedmann
> <[email protected]>wrote:
> 
>> 
>> Hi,
>> 
>> I am currently converting an existing application to Guice. To simplify
>> the migartion, I'd like to do somehing like
>> 
>> 
>>    Foo someInstance;
>>    Provider<Foo> myProvider = new Provider<Foo>(){
>>        Foo get() { return someInstance; }
>>    }
>> 
>>    binder.bind(IFoo.class).toProviderInstance(myProvider);
>> 
>> Is that possible?
>> 
>> Thanks,
>> 
>> Jochen
>> 
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/google-guice.
>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to