Skip to content

BeanCurrentlyInCreationException is thrown when multiple threads simultaneously try to create bean (Spring 6.2.2) #34373

Open
@mpwong852

Description

It is similar problem what is described in the issue #34186

The Spring version is "6.2.2" & Spring boot version is "3.4.2"

My application implements CommandLineRunner, and is a jar file.

The BeanCurrentlyInCreationException will be happen when I run the jar file sometime.

Below is the detail log:

2025-02-05 16:55:39,016207| INFO|TID=74|HAControllerThread|DefaultListableBeanFactory:|Creating singleton bean 'inplayIncidentDao' in thread "HAControllerThread" while other thread holds singleton lock for other beans

2025-02-05 16:55:39,065783|DEBUG|TID=1|main|DefaultListableBeanFactory:|Creating shared instance of singleton bean 'inplayIncidentDao'

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'inplayIncidentDao': Requested bean is currently in creation: Is there an unresolvable circular reference or an asynchronous initialization dependency?

These issues occur randomly, and this problems is start from Spring Framework 6.2.x.

I never face those issue in Spring Framework 6.1.x

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: waiting-for-feedbackWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triaged or decided on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions