springboot报错:Java Error creating bean with name:Bean with name has been injected into other beans…
问题描述:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name overTimeRemainTask : Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name taskService : Bean with name taskService has been injected into other beans [submitTestService] 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相互装配对方的实例,出现循环引用的情况,导致报错。


解决方法:
去掉其中一个service的@resource注解和service变量,解决相互嵌套引用即可。


