From ab785d9417a8a904e276e557d6ecaef5c7460b2b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 14 Apr 2021 15:38:34 +0200 Subject: [PATCH] Document limitations of using deferred JPA bootstrap Closes gh-24027 --- .../src/docs/asciidoc/spring-boot-features.adoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index 07f1c32bd82d..0af49d74f6c1 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -3893,7 +3893,13 @@ To enable deferred or lazy bootstrapping, set the configprop:spring.data.jpa.rep When using deferred or lazy bootstrapping, the auto-configured `EntityManagerFactoryBuilder` will use the context's `AsyncTaskExecutor`, if any, as the bootstrap executor. If more than one exists, the one named `applicationTaskExecutor` will be used. -NOTE: When using deferred or lazy bootstraping, make sure to defer any access to the JPA infrastructure after the application context bootstrap phase. +[NOTE] +==== +When using deferred or lazy bootstraping, make sure to defer any access to the JPA infrastructure after the application context bootstrap phase. +You can use `SmartInitializingSingleton` to invoke any initialization that requires the JPA infrastructure. +For JPA components (such as converters) that are created as Spring beans, use `ObjectProvider` to delay the resolution of dependencies, if any. +==== + TIP: We have barely scratched the surface of Spring Data JPA. For complete details, see the {spring-data-jdbc-docs}[Spring Data JPA reference documentation].