Spring 由于循环依赖性,升级到 2.6.0 后启动应用程序无法启动 [无法解析的循环引用]

Spring boot application fails to start after upgrading to 2.6.0 due to circular dependency[ unresolvable circular reference]

Spring开机升级错误

Spring 由于循环依赖,引导应用程序在升级到 2.6.0 后无法启动

Error creating bean with name 'securityConfig': 
Requested bean is currently in creation: Is there an 
      unresolvable circular reference?

Circular References Prohibited by Default 在 spring 启动版本 2.6

如果您的应用程序由于 BeanCurrentlyInCreationException 而无法启动,强烈建议您更新配置以打破依赖循环。

临时解决办法是恢复2.5的行为,在.properties/yml,

中设置如下
spring: 
  main:
    allow-circular-references: true

有关详细说明和一些可能的补救措施,请参阅 this article