BeanCurrentlyInCreationException is thrown when multiple threads simultaneously try to create a factory bean after upgrade to spring 6.2.0 #33972
Labels
status: waiting-for-triage
An issue we've not yet triaged or decided on
After upgrading to spring boot 3.4 and spring 6.2.0 we sometimes see a BeanCurrentlyInCreationException in our logs after application startup.
Looking into it, this seems to be happening when multiple threads simultaneously first create a FactoryBean (in our application we are using spring mvc and this happens when multiple concurrent http requests happen after startup where a
BeanCurrentlyInCreationException
is thrown for a request scoped bean).This was working fine in spring 6.1.15 and is broken in 6.2.0.
From a quick look, I would suspect that this is related to changes in this issue where locking in FactoryBeanRegistrySupport was removed.
The following is an example test (inspired by the example of this issue) which runs without any exception in 6.1.15 but does throw an exception in 6.2.0
The text was updated successfully, but these errors were encountered: