Status: New
Owner: ----

New issue 690 by [email protected]: Do not fail on circular constructor/setter dependency
http://code.google.com/p/google-guice/issues/detail?id=690

===
public static class A {
    private final B b;

    @Inject
    public A(B b) {
        this.b = b;
    }
}

public static class B {
    private A a;

    @Inject
    public void setA(A a) {
        this.a = a;
    }
}

public static void main(String[] args) {
    Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() { }
    }).getInstance(A.class);
}
===

guice reports error:

===
Tried proxying com.company.Temp$A to support a circular dependency, but it is not an interface
===

Proxy is not needed here: guice should just create "B" first, inject it into "A" constructor and then inject "A" into "B".

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
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-dev?hl=en.

Reply via email to