spring的循环引用无非就是bean a ->bean b-> bean a
我的解决方法有三种
1、移除引用链。 打破互相引用
2、@Lazy加载
3、使用setter或者@autowired
第三种是因为创建Bean,实际上它此时的依赖并没有被注入,只有在你需要的时候他才会被注入进来。
官方链接:https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans
spring的循环引用无非就是bean a ->bean b-> bean a
我的解决方法有三种
1、移除引用链。 打破互相引用
2、@Lazy加载
3、使用setter或者@autowired
第三种是因为创建Bean,实际上它此时的依赖并没有被注入,只有在你需要的时候他才会被注入进来。
官方链接:https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans