Search code examples
javaspring-bootjava-17

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


Spring boot upgrade Error

Spring boot application fails to start after upgrading to 2.6.0 due to circular dependency

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

Solution

  • Circular References Prohibited by Default in spring boot version 2.6

    If your application fails to start due to a BeanCurrentlyInCreationException you are strongly encouraged to update your configuration to break the dependency cycle.

    The temporary solution is to restore 2.5’s behavior, set the following in .properties/yml,

    spring: 
      main:
        allow-circular-references: true
    

    See this article for an in-depth description and some possible remedies.