Allow Data JPA's bootstrap mode to be configured via the environment
In Spring Data Lovelace, repositories' bootstrap mode can be configured via @EnableJpaRepositories. This commit adds support for configuring the mode via the environment rather than having to use the annotation. Additionally, when deferred or lazy bootstrapping is being used, the LocalContainerEntityManagerFactoryBean is configured to use a bootstrap executor. This allows JPA's initialization to be performed on a separate thread, allowing the rest of application context initialization to proceed in parallel. Closes gh-13833
This commit is contained in:
@@ -778,6 +778,7 @@ content into your application. Rather, pick only the properties that you need.
|
||||
spring.jdbc.template.query-timeout= # Query timeout. Default is to use the JDBC driver's default configuration. If a duration suffix is not specified, seconds will be used.
|
||||
|
||||
# JPA ({sc-spring-boot-autoconfigure}/orm/jpa/JpaBaseConfiguration.{sc-ext}[JpaBaseConfiguration], {sc-spring-boot-autoconfigure}/orm/jpa/HibernateJpaAutoConfiguration.{sc-ext}[HibernateJpaAutoConfiguration])
|
||||
spring.data.jpa.repositories.boostrap-mode=default # Bootstrap mode for JPA repositories.
|
||||
spring.data.jpa.repositories.enabled=true # Whether to enable JPA repositories.
|
||||
spring.jpa.database= # Target database to operate on, auto-detected by default. Can be alternatively set using the "databasePlatform" property.
|
||||
spring.jpa.database-platform= # Name of the target database to operate on, auto-detected by default. Can be alternatively set using the "Database" enum.
|
||||
|
||||
@@ -3694,6 +3694,12 @@ The following example shows a typical Spring Data repository interface definitio
|
||||
}
|
||||
----
|
||||
|
||||
Spring Data JPA repositories support three different modes of bootstrapping: default,
|
||||
deferred, and lazy. To enable deferred or lazy bootstrapping, set the
|
||||
`spring.data.jpa.repositories.bootstrap-mode` to `deferred` or `lazy` respectively. When
|
||||
using deferred or lazy bootstrapping, the auto-configured `EntityManagerFactoryBuilder`
|
||||
will use the context's async task executor, if any, as the bootstrap executor.
|
||||
|
||||
TIP: We have barely scratched the surface of Spring Data JPA. For complete details, see
|
||||
the https://docs.spring.io/spring-data/jpa/docs/current/reference/html/[Spring Data JPA
|
||||
reference documentation].
|
||||
|
||||
Reference in New Issue
Block a user