在做瑞吉外卖的修改套餐时,想在SetmealServiceImpl注入SetmealService(已经注解掉)
结果报错,springboot循环依赖问题,项目启动不了
后面发现:把注入的setmealService注释掉就可以
真实报错如下:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'categoryController': Unsatisfied dependency expressed through field 'categoryService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'categoryServiceImpl': Unsatisfied dependency expressed through field 'setmealService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'setmealServiceImpl': Unsatisfied dependency expressed through field 'setmealService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'setmealServiceImpl': Requested bean is currently in creation: Is there an unresolvable circular reference?