Hi all,

We're working on quite a big project, already using dependency injection in 
90% of the places, but without a framework. After having to modify 33 files 
just to add one dependency into one deeply nested class, I'm convinced that 
we should use a DI framework. Google Guice is one of the candidates. I've 
read the guide and learned about scopes, but one thing that is unclear to 
me is the following.

What we have is something like this. Class A, that contains one or more 
objects of type B, that each contain a reference to the same object of type 
C. My question is about C. You might think that C should be a singleton, 
but actually it's a bit more complex. The scope of C depends on A. Hence, 
for each A there should be one C. And all the B's in that A instance should 
have a reference to that instance of C, while all the B's in the other A's 
instance, should have a reference to the other C instance.

So something like this:

a1 -> b1 -> c1
a1 -> b2 -> c1
a1 -> b3 -> c1

a2 -> b4 -> c2
a2 -> b5 -> c2
a2 -> b6 -> c2

Is this possible using Guice? How would one do this?


Tonni Tielens

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 google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to