I have the same problem... did you find any solution? 
Regards.

On Thursday, January 17, 2013 1:11:22 PM UTC-6, Morgaine Fowle wrote:
>
> Generally I prefer breaking my AbstractModule's into as many @Provides as 
> I can.
>
> However, I'm having problems making a dynamical @Provides method (as per 
> https://groups.google.com/forum/?fromgroups=#!topic/google-guice/TO_OUo7jjeo 
> ) 
> and I'm here resorting to having to use a more programmatic 
> AbstractModule.configure() way of defining up front all the various 
> possible bindings I might need.
>
> Is there any way my AbstractModule.configure() method can rely on other 
> @Provides methods defined in the class? I haven't found any way of doing 
> this. this.getProvider(MyDesiredClass.class) throws an exception, I've 
> tried using an @Inject'ed private member, which also throws: it seems like 
> configure() is the first thing that gets run and one is SOL w/r/t the 
> @Providers being able to help it.
>
> Example of desired use:
>
> @Provides
> public String provideString(){return "yes";}
>
> @Override
> protected void configure(){
>   final String input = this.getProvider(String.class).get();
>   this.bind(String.class).annotateWith("special").toInstance(input);
> }
>
> Fails, but demonstrates use of a @Provides to satisfy my configure(), 
> which is what I'd like to do.
>
> Regards,
> MF
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to