xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Circular dependencies with @Provides @Singleton methods don't create singletons. #613

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See the attached file. Two "singleton" StringBuilders are created. Guice 3.0 
properly catches this with the error "Provider was reentrant while creating a 
singleton".

The workaround is to inject Provider<StringBuilder> into SomeClass.

I don't expect this to get fixed since there's a workaround and Guice 3.0 
(which doesn't have the issue) is right around the corner, but I figured I'd 
file it anyway.

Original issue reported on code.google.com by plu...@gmail.com on 8 Mar 2011 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 8 Mar 2011 at 8:02