Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ private void captureTestClassPreparers(TestContext testContext, RefreshMode... r
private void forEachDatabase(TestContext testContext, RefreshMode[] refreshModes, BiConsumer<DatabaseContext, AutoConfigureEmbeddedDatabase> action) {
Set<AutoConfigureEmbeddedDatabase> annotations = AnnotationUtils.getDatabaseAnnotations(testContext.getTestClass());

if (annotations.isEmpty()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this brings any difference, because it is only used in a .forEach() part. A .forEach() on a empty Set will already do nothing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real issue was in calling the testContext.getApplicationContext() method below. This method call could trigger eager initialization of Spring context, even without presence of the @AutoConfigureEmbeddedDatabase annotation.

return;
}

ApplicationContext applicationContext = testContext.getApplicationContext();
Environment environment = applicationContext.getEnvironment();

Expand Down
Loading