-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behavior on Inject Injector instance in Constructor #353
Comments
From tregubov on April 05, 2009 08:51:32 P.S I Used * guice-assistedinject-snapshot20090205.jar
|
From tregubov on April 05, 2009 09:01:45 Some Investigations: I have Root Injector(#1). One Child injector(#2) under it. And One Child Injector(#3) java.util.Set<ru.faulab.fmsgenerator.core.document.DocumentTemplate> - register in When GUI has dependecy to FMSDocument it got Injector refernced to #2 but when i I think this information can help you |
From tregubov on April 11, 2009 03:15:49 I create little Example with BAG. You can see it in attachment. You can reproduce the Bag here When You in /BAG/ version you got null in System.out. Mean Root Injector Injector[bindings=[ProviderInstanceBinding[key=Key[type=com.google.inject.Injector, Attachment: gist |
From limpbizkit on April 11, 2009 10:15:50 If you read the doc carefully for createChildInjector(), it suggests that the binding for GUI will live in the top- The solution is to use an explicit binding for GUI. In your child injector, add this statement: Status: Invalid |
From tregubov on April 11, 2009 10:53:03 thank you very much. I miss this section, but it not so obvious (IMHO). But i don't So i have only one way, as i understand, use unnecessary dependency. :( |
From tregubov on April 05, 2009 11:47:47
I can't explain why and can't create little example with error. I try to
attach my project but system reject my submit. I can give all required
information. Can send my sources
Run ru.faulab.fmsgenerator.FMSRunTest.
Look on class ru.faulab.fmsgenerator.gui.GUI. It has unnecessary dependency
on FMSDocuments constructor
@
Injectpublic GUI(Injector parentInjector, FMSDocuments fmsDocuments)
BUT WHEN I REMOVE THIS DEPENDENCY like
@
Injectpublic GUI(Injector parentInjector)
I got the error
Exception in thread "main" com.google.inject.ProvisionException: Guice
provision errors:
java.util.Set<ru.faulab.fmsgenerator.core.document.DocumentTemplate> was
bound.
while locating
java.util.Set<ru.faulab.fmsgenerator.core.document.DocumentTemplate>
for parameter 0 at
ru.faulab.fmsgenerator.core.document.DocumentTemplateHolder.<init>(Document
TemplateHolder.java:20)
while locating
ru.faulab.fmsgenerator.core.document.DocumentTemplateHolder
for parameter 1 at
ru.faulab.fmsgenerator.gui.action.GenerateAction.<init>(GenerateAction.java
:30)
at ru.faulab.fmsgenerator.gui.GUIModule.configure(GUIModule.java:29)
at ru.faulab.fmsgenerator.gui.GUI.<init>(GUI.java:25)
while locating ru.faulab.fmsgenerator.gui.GUI
while locating ru.faulab.fmsgenerator.core.XUI
WHY???. Please Explain me. This is a bug or feature.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=353
The text was updated successfully, but these errors were encountered: