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,反之同理。
注意:
尽量不要导致循环依赖。