admin管理员组

文章数量:1534194

今天在项目编码过程中,出现了下面的异常:

org.springframework.beans.factory.BeanCurrentlyInCreationException: 
Error creating bean with name 'systemService': 
Bean with name 'systemService' has been injected into other beans [yeeDoctorsImpactService] 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

1、原因: systemService 类中注入了 yeeDoctorsImpactService , 而在 yeeDoctorsImpactService 类中也注入了 systemService ,从而引起该异常。(循环引用)

2、解决: systemService 类注入 yeeDoctorsImpactService 时,增加注解@Lazy,反之同理。

在平时的项目编码过程中,尽量不要导致循环依赖。

本文标签: beansRAWbeaninjectedcircular