XmlBeanDefinitionReader stores resourcesCurrentlyBeingLoaded in a ThreadLocal.

Because I have lots of small bean files in my project, I am trying to using multiple threads to load bean definitions, which causes errors.

Why it is designed like this?

Comment From: bclozel

The container initialization is single threaded; this is why we can use a ThreadLocal there. I guess you're interested in adding concurrency to that process. You'll find more information in #13410 and I'm closing this issue as a duplicate as a result.