Skip to content

Commit 1075bae

Browse files
committed
Document repeatable @TestPropertySource support in reference manual
See gh-23320
1 parent 136af0b commit 1075bae

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/docs/asciidoc/testing.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ The following example demonstrates how to declare inlined properties:
688688
----
689689
<1> Declare `timezone` and `port` properties.
690690

691+
See <<testcontext-ctx-management-property-sources>> for examples and further details.
691692

692693
[[spring-testing-annotation-dirtiescontext]]
693694
===== `@DirtiesContext`
@@ -2841,6 +2842,24 @@ The following example sets two inlined properties:
28412842
----
28422843
<1> Setting two properties by using two variations of the key-value syntax.
28432844

2845+
[NOTE]
2846+
====
2847+
As of Spring Framework 5.2, `@TestPropertySource` can be used as _repeatable annotation_.
2848+
That means that you can have multiple declarations of `@TestPropertySource` on a single
2849+
test class, with the `locations` and `properties` from later `@TestPropertySource`
2850+
annotations overriding those from previous `@TestPropertySource` annotations.
2851+
2852+
In addition, you may declare multiple composed annotations on a test class that are each
2853+
meta-annotated with `@TestPropertySource`, and all of those `@TestPropertySource`
2854+
declarations will contribute to your test property sources.
2855+
2856+
Directly present `@TestPropertySource` annotations always take precedence over
2857+
meta-present `@TestPropertySource` annotations. In other words, `locations` and
2858+
`properties` from a directly present `@TestPropertySource` annotation will override the
2859+
`locations` and `properties` from a `@TestPropertySource` annotation used as a
2860+
meta-annotation.
2861+
====
2862+
28442863

28452864
====== Default Properties File Detection
28462865

0 commit comments

Comments
 (0)