Do not fail on circular constructor/setter dependency
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 1.7k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
_From [stepan.koltsov](https://code.google.com/u/113939464116033188989/) on March 07, 2012 14:42:18_
#
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".
_Original issue: http://code.google.com/p/google-guice/issues/detail?id=690_
Contributor guide
Assessment
This issue has not been assessed yet.