Spring项目启动时Error creating bean with name ‘xxxxxx‘: Bean with name ‘xxxxxx‘ has been injected into ot

报错信息:

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘xxxxxx’: Bean with name ‘xxxxxx’ has been injected into other beans [xxxxxx] 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 ‘getBeanNamesForType’ with the ‘allowEagerInit’ flag turned off, for example.

在这里插入图片描述
解决方案
找到代码中对应引用的service,注入时使用static关键字,来判断当前对象是否已经存在,如果不存在new个出来。(单例)

参考博客:

https://blog.csdn.net/m290345792/article/details/124936928


版权声明:本文为l_mloveforever原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。