Files
spring-boot/module/spring-boot-data-jpa
Ns 8c519369ec Lazily resolve JPA fallback bootstrap executor
Previously, the `entityManagerFactoryBuilder` bean method injected a
`Map<String, AsyncTaskExecutor>` to determine the fallback executor used
for background JPA bootstrapping. A `Map` parameter is resolved eagerly,
so this forced early initialization of every `AsyncTaskExecutor` bean
whenever the builder was created, even when background bootstrapping was
not in use. When an `AsyncTaskExecutor` directly or transitively
depended on the `EntityManagerFactory`, this resulted in a
`BeanCurrentlyInCreationException`.

The fallback executor is now resolved lazily.
`EntityManagerFactoryBuilder` holds a `Supplier` that is only invoked
when background bootstrapping is actually required, and the executor is
then looked up from the `BeanFactory` rather than eagerly injected. A
new `Supplier`-based constructor is added for this purpose; the existing
constructor that accepts an `AsyncTaskExecutor` is retained and
delegates to it.

The same eager `Map<String, AsyncTaskExecutor>` injection, along with an
unused private method, is also removed from
`DataJpaRepositoriesAutoConfiguration`.

See gh-50801

Signed-off-by: Ns <397827222@qq.com>
2026-07-14 17:11:14 +02:00
..
2026-05-14 15:02:24 +01:00