admin管理员组

文章数量:1534198

报错:has been injected into other beans [] in its raw version as part of a circular reference,but has eventually been wrapped.This meas that said other beans do not use the final version of the bean

原因:循环依赖的bean被动态代理重新包装了。我在项目中使用BeanPostProcessor动态代理包装了一个有循环依赖的bean就报了这个错误。

解决办法:使用SmartInstantiationAwareBeanPostProcessor代替BeanPostProcessor,重写下面的getEarlyBeanReference方法创建动态代理可以解决。

原理:

可以参考此篇博客,了解下SmartInstantiationAwareBeanPostProcessor是在何处调用的:

SmartInstantiationAwareBeanPostProcessor-CSDN博客

本文标签: RAWbeansinjectedVersionreference