admin管理员组

文章数量:1534214

文章目录

      • 1 问题
      • 2 解决方法
      • 3 悔恨

1 问题

  • springBoot启动失败,报错BeanCurrentlyInCreationException
org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'AxxxxService': 
Bean with name 'BxxxxService' 
has been injected into other beans [CxxxxService] 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 解决方法

  • 1 找到中括号中的Service: CxxxxService
  • 2 在CxxxxService中找到 BxxxxService(离得最近的,如果看不懂英文的话)的声明
  • 3 在BxxxService的声明上加注解 @Lazy
    注: 如果中括号中不止一个CxxxxService,每个都要这样做,加上@Lazy

3 悔恨

  • 我没有一开始就百度,解决方案,而是自以为是地组装新的Service类
  • 今天遇到一个中括号里有多个类的,要改的多了,就搜索一下人家的解决方案,流下了悔恨的眼泪
  • 现在才把代码调整回去了,已经晚上10点多了
  • 本来想试试revert, 过去太久,太多commit了,害怕了,退缩了

本文标签: 项目SpringBootreferencecircular