Hi everyone,

Not sure how active this group is anymore, but I’m having a very strange 
problem that I can seem to get to the bottom of. It could actually be the 
normal behavior of Guice, but I’m guessing it isn’t.

Here’s an example:

Let’s say I have 3 services named ServiceA, ServiceB and ServiceC and then a 
Controller. The dependencies look like this:

Controller -> ServiceA
Controller -> ServiceB
Controller -> ServiceC
ServiceA -> ServiceB
ServiceA -> ServiceC
ServiceB -> ServiceC

Essentially, ServiceC is being used everywhere. When I create an instance of 
the Controller, Guice is creating 3 or more instances of ServiceC. In my 
real-world case, Guice is creating 500+ or more instances of a single service 
for each request to the application. It seems like Guice should only be 
creating 1 instance of ServiceC since it is a leaf node in the graph and the 
graph is being constructed from a single location (Controller).

A bit of additional detail, we are using multi-binders in some places and the 
classes being bound into the collections do use a number of services.

Anyone have this issue and figure out how to solve it?

Thanks,
— Brian

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/1BA470AA-6E4D-4471-A7AA-C03ED80C7FC2%40pontarelli.com.

Reply via email to