Bean with name '' has been injected into other beans [] in its raw version as part of a circular
1、报错信息
Unsatisfied dependency expressed through field 'xxxService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'xxxServiceImpl': Bean with name 'xxxServiceImpl' has been injected into other beans [yyyServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
2、错误原因:
xxxService 类中注入了 yyyService , 而在 yyyService 类中也注入了 xxxService
3、解决方式:
xxxService 类注入 yyyService 时,增加注解@Lazy,反之同理。
注意:
尽量不要导致循环依赖。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步