Hi Fred! Thanks for your reply!

Idea number 2 has to be ruled out, because it doesn't fit to my usecase. 
Besides, AssistedInject is rather rigid, for example when it comes to 
circular dependencies - then AssistedInject simply doesn't work (at least 
in my tests) ...

The first idea would be doable, but exactly the point that you mentioned at 
the end about the costs of creating injectors brought me to my idea with 
child injectors. I thought that I could decrease performance penalty with 
that approach.


On Sunday, July 29, 2012 12:08:08 AM UTC+2, Fred Faber wrote:
>
> I suspect there's another solution to the problem you're trying to solve 
> here.  Without knowing what that is, here are my guesses:
>
> 1) you don't actually need the parent injector, and you can pass an 
> incomplete Module around until you need to create an injector, at which 
> point you can combine that Module with the Module with your additional 
> bindings in it
> 2) you use the parent injector, but want to use a runtime parameter to 
> create objects of the same type in different contexts.  In that case, 
> AssistedInject 
> <http://code.google.com/p/google-guice/wiki/AssistedInject>should do what you 
> want.  
>
> Keep in mind also that creating an injector can be expensive.
>
> Fred
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/7mSYToYHt_EJ.
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