Skip to content

Commit 93d8334

Browse files
committed
Merge branch '2.3.x'
Closes gh-24401
2 parents 7b2f24a + 06671aa commit 93d8334

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfiguration.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ private static final class BootstrapExecutorCondition extends AnyNestedCondition
9696
}
9797

9898
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "bootstrap-mode",
99-
havingValue = "deferred", matchIfMissing = true)
99+
havingValue = "deferred")
100100
static class DeferredBootstrapMode {
101101

102102
}
103103

104-
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "bootstrap-mode", havingValue = "lazy",
105-
matchIfMissing = false)
104+
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "bootstrap-mode", havingValue = "lazy")
106105
static class LazyBootstrapMode {
107106

108107
}

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesRegistrar.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected RepositoryConfigurationExtension getRepositoryConfigurationExtension()
5757

5858
@Override
5959
protected BootstrapMode getBootstrapMode() {
60-
return (this.bootstrapMode == null) ? BootstrapMode.DEFERRED : this.bootstrapMode;
60+
return (this.bootstrapMode == null) ? BootstrapMode.DEFAULT : this.bootstrapMode;
6161
}
6262

6363
@Override

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@
622622
"name": "spring.data.jpa.repositories.bootstrap-mode",
623623
"type": "org.springframework.data.repository.config.BootstrapMode",
624624
"description": "Bootstrap mode for JPA repositories.",
625-
"defaultValue": "deferred"
625+
"defaultValue": "default"
626626
},
627627
{
628628
"name": "spring.data.jpa.repositories.enabled",

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,12 @@ void whenBootstrapModeIsDefaultBootstrapExecutorIsNotConfigured() {
126126
}
127127

128128
@Test
129-
void bootstrapModeIsDeferredByDefault() {
129+
void bootstrapModeIsDefaultByDefault() {
130130
this.contextRunner.withUserConfiguration(MultipleAsyncTaskExecutorConfiguration.class)
131131
.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class,
132132
TaskSchedulingAutoConfiguration.class))
133133
.run((context) -> assertThat(
134-
context.getBean(LocalContainerEntityManagerFactoryBean.class).getBootstrapExecutor())
135-
.isEqualTo(context.getBean("applicationTaskExecutor")));
134+
context.getBean(LocalContainerEntityManagerFactoryBean.class).getBootstrapExecutor()).isNull());
136135
}
137136

138137
@Configuration(proxyBeanMethods = false)

Diff for: spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,8 @@ To enable deferred or lazy bootstrapping, set the configprop:spring.data.jpa.rep
42634263
When using deferred or lazy bootstrapping, the auto-configured `EntityManagerFactoryBuilder` will use the context's `AsyncTaskExecutor`, if any, as the bootstrap executor.
42644264
If more than one exists, the one named `applicationTaskExecutor` will be used.
42654265

4266+
NOTE: When using deferred or lazy bootstraping, make sure to defer any access to the JPA infrastructure after the application context bootstrap phase.
4267+
42664268
TIP: We have barely scratched the surface of Spring Data JPA.
42674269
For complete details, see the {spring-data-jdbc-docs}[Spring Data JPA reference documentation].
42684270

Diff for: spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@
103103

104104
/**
105105
* The {@link BootstrapMode} for the test repository support. Defaults to
106-
* {@link BootstrapMode#LAZY}.
106+
* {@link BootstrapMode#DEFAULT}.
107107
* @return the {@link BootstrapMode} to use for testing the repository
108108
*/
109109
@PropertyMapping("spring.data.jpa.repositories.bootstrap-mode")
110-
BootstrapMode bootstrapMode() default BootstrapMode.LAZY;
110+
BootstrapMode bootstrapMode() default BootstrapMode.DEFAULT;
111111

112112
/**
113113
* Determines if default filtering should be used with

Diff for: spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ void liquibaseAutoConfigurationWasImported() {
109109
}
110110

111111
@Test
112-
void bootstrapModeIsLazyByDefault() {
112+
void bootstrapModeIsDefaultByDefault() {
113113
assertThat(this.applicationContext.getEnvironment().getProperty("spring.data.jpa.repositories.bootstrap-mode"))
114-
.isEqualTo(BootstrapMode.LAZY.name());
114+
.isEqualTo(BootstrapMode.DEFAULT.name());
115115
}
116116

117117
}

0 commit comments

Comments
 (0)