Skip to content

Conversation

@tomix26
Copy link
Collaborator

@tomix26 tomix26 commented Nov 25, 2024

No description provided.

@tomix26 tomix26 merged commit 5a1befb into master Nov 25, 2024
7 checks passed
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants