The PR changed the org. Springframework. Beans. Factory. Support. DefaultListableBeanFactory resolveNamedBean method, To resolve the issue of getting an uninitialized bean that can occur when concurrently executing getBean to get a bean that contains a loop dependency. Ref: #31261

Comment From: pivotal-cla

@nineya Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@nineya Thank you for signing the Contributor License Agreement!

Comment From: snicoll

See also #26376

Comment From: jhoeller

For circular reference resolution, any access to a Spring bean needs to be able to receive an early-exposed singleton whenever needed, so we can't artificially block in resolveNamedBean there. If you'd like to avoid the circular reference problem completely, set your factory to setAllowCircularReferences(false) which will avoid any exposure to earlySingletonObjects to begin with, therefore never returning an early singleton object from resolveNamedBean either.

Note that we are considering to disallow circular references by default in a future Spring Framework generation. However, as long as we need to be able to resolve circular references, we need to keep those bean retrieval methods as lenient as they are.