Bean with name ‘xxx‘ has been injected into other beans
程序员文章站
2022-04-15 13:29:34
...
更新代码以后,打完jar包,启动失败报Bean with name 'xxx' has been injected into other beans异常
项目里面两个类循环引用导致spring不知道先去加载哪个类
public class Demo1{
@Autowired
Demo2 demo2;
}
public class Demo2{
@Autowired
Demo1 demo1;
}
添加@Lazy懒加载解决
上一篇: linux中怎么打开软件