Skip to content

Add @NestedTestConfiguration example to the testing docs - #37631

Merged
sbrannen merged 1 commit into
spring-projects:mainfrom
anqorithm:docs-nested-test-configuration-example
Nov 21, 2026
Merged

sbrannen merged 1 commit into
spring-projects:mainfrom
anqorithm:docs-nested-test-configuration-example

Conversation

@anqorithm

Copy link
Copy Markdown
Contributor

The @Nested test class section only showed configuration being inherited, with no example of @NestedTestConfiguration. This adds one. It shows a nested class using OVERRIDE and declaring its own configuration, explains that nothing from the enclosing class is inherited in that mode, and adds a tip that @TestPropertySource(inheritProperties = false) is enough when only the properties need to change.

I checked the example and the behaviour it describes with a small JUnit test against the current snapshot, but I didn't build the docs site.

Closes gh-28632

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 2, 2026
@sbrannen sbrannen added in: test Issues in the test module type: documentation A documentation task labels Nov 3, 2026
@sbrannen sbrannen self-assigned this Nov 3, 2026
@anqorithm

This comment was marked as outdated.

@anqorithm

This comment was marked as outdated.

@sbrannen sbrannen added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 21, 2026
@sbrannen sbrannen added this to the 7.1.1 milestone Nov 21, 2026
@sbrannen sbrannen changed the title Add @NestedTestConfiguration example to the testing docs Add @NestedTestConfiguration example to the testing docs Nov 21, 2026
Closes spring-projectsgh-28632

Signed-off-by: anqorithm <61029571+anqorithm@users.noreply.github.com>
@anqorithm

Copy link
Copy Markdown
Contributor Author

Thanks, that reads much better. I've added the nested EnglishGreetings class without @ActiveProfiles to both the Java and Kotlin examples, and the text now explains that it inherits @SpringJUnitConfig(TestConfig.class) and @ActiveProfiles("lang_en") while FrenchGreetings overrides both.

@anqorithm
anqorithm force-pushed the docs-nested-test-configuration-example branch from d124766 to 7d5d48d Compare November 21, 2026 14:50
@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 21, 2026
@sbrannen sbrannen removed the status: feedback-provided Feedback has been provided label Nov 21, 2026
@sbrannen
sbrannen merged commit b34ac80 into spring-projects:main Nov 21, 2026
3 checks passed
@sbrannen

Copy link
Copy Markdown
Member

This has been merged into main.

Thanks

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

Labels

in: test Issues in the test module type: documentation A documentation task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add example using @NestedTestConfiguration

3 participants