Skip to content

Fix documented default of spring.test.database.replace - #51709

Merged
snicoll merged 1 commit into
spring-projects:4.0.xfrom
ohchanKyu:fix-test-database-replace-metadata-default
Sep 14, 2026
Merged

snicoll merged 1 commit into
spring-projects:4.0.xfrom
ohchanKyu:fix-test-database-replace-metadata-default

Conversation

@ohchanKyu

Copy link
Copy Markdown
Contributor

The manually declared metadata for spring.test.database.replace in spring-boot-jdbc-test still
advertises any as the default value. The actual default has been NON_TEST
since 3.4 (8628f73, "Ensure @AutoConfigureTestDatabase does not replace test databases"): AutoConfigureTestDatabase.replace() defaults to Replace.NON_TEST and
TestDatabaseAutoConfiguration uses matchIfMissing = true for NON_TEST.

As this property controls which DataSource gets replaced in tests, IDEs showing the wrong default is misleading.
This PR changes the default to non-test, following the dashed lower-case form the annotation processor uses for
enum defaults.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Sep 12, 2026
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. labels Sep 12, 2026
@wilkinsona wilkinsona added this to the 4.0.x milestone Sep 12, 2026
@snicoll
snicoll force-pushed the fix-test-database-replace-metadata-default branch from d3d193e to 9439ecf Compare September 14, 2026 08:28
@snicoll snicoll self-assigned this Sep 14, 2026
@snicoll snicoll modified the milestones: 4.0.x, 4.0.9 Sep 14, 2026
The default of @AutoConfigureTestDatabase's replace attribute changed
from ANY to NON_TEST in 3.4 but the manually declared metadata for
spring.test.database.replace still advertised "any" as the default.

See spring-projectsgh-51709

Signed-off-by: ohchanKyu <okc0202@naver.com>
@snicoll
snicoll force-pushed the fix-test-database-replace-metadata-default branch from 9439ecf to 911c4a4 Compare September 14, 2026 08:58
@snicoll
snicoll merged commit 96f5c74 into spring-projects:4.0.x Sep 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: documentation A documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants