报错
···
Caused by: java.lang.StackOverflowError
···
代码
···
@IocBean(singleton = false)
class A{
@inject
B
}
@IocBean(singleton = false)
class B{
}
···
在不加singleton = false时是可以正常注入的,但是加了之后就报栈溢出了,如何解决呢???
测试代码如下:
package org.nutz.ioc.loader.annotation.meta.issue1191;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(singleton=false)
public class Issue1191A {
@Inject
protected Issue1191B issue1191b;
}
package org.nutz.ioc.loader.annotation.meta.issue1191;
import org.nutz.ioc.loader.annotation.IocBean;
@IocBean(singleton=false)
public class Issue1191B {
}
@Test
public void test_issue1191() {
AnnotationIocLoader loader = new AnnotationIocLoader(getClass().getPackage().getName());
NutIoc ioc = new NutIoc(loader);
ioc.get(Issue1191A.class);
ioc.depose();
}
测试结果: pass