Doesn't @Provides work by wrapping those method invocations with a Provider
instance? If you do @Provides Foo you will already be able to inject a
provider for Foo. Not sure if that is what you mean.

Robbie

On Tue, Sep 15, 2009 at 5:35 PM, Sam Berlin <[email protected]> wrote:

> Hi Folks,
>
> It's currently not possible to have an @Provides Provider<Foo> method in a
> Module (Guice throws an exception saying binding to Provider is not
> allowed).  While technically this is achievable by having a class implement
> Provider & binding to the class, I find the shorthand of @Provides to be
> much much easier & simpler (with parameters passed into the method as
> dependencies, etc..).  Would it be possible to relax that restriction and
> allow a binding to a Provider act the same as bind(..).toProvider(...)?
>
> Thanks!
>
> Sam
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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