Browse Source

Document repeatable @TestPropertySource support in reference manual

See gh-23320
pull/23382/head
Sam Brannen 7 years ago
parent
commit
1075bae280
  1. 19
      src/docs/asciidoc/testing.adoc

19
src/docs/asciidoc/testing.adoc

@ -688,6 +688,7 @@ The following example demonstrates how to declare inlined properties: @@ -688,6 +688,7 @@ The following example demonstrates how to declare inlined properties:
----
<1> Declare `timezone` and `port` properties.
See <<testcontext-ctx-management-property-sources>> for examples and further details.
[[spring-testing-annotation-dirtiescontext]]
===== `@DirtiesContext`
@ -2841,6 +2842,24 @@ The following example sets two inlined properties: @@ -2841,6 +2842,24 @@ The following example sets two inlined properties:
----
<1> Setting two properties by using two variations of the key-value syntax.
[NOTE]
====
As of Spring Framework 5.2, `@TestPropertySource` can be used as _repeatable annotation_.
That means that you can have multiple declarations of `@TestPropertySource` on a single
test class, with the `locations` and `properties` from later `@TestPropertySource`
annotations overriding those from previous `@TestPropertySource` annotations.
In addition, you may declare multiple composed annotations on a test class that are each
meta-annotated with `@TestPropertySource`, and all of those `@TestPropertySource`
declarations will contribute to your test property sources.
Directly present `@TestPropertySource` annotations always take precedence over
meta-present `@TestPropertySource` annotations. In other words, `locations` and
`properties` from a directly present `@TestPropertySource` annotation will override the
`locations` and `properties` from a `@TestPropertySource` annotation used as a
meta-annotation.
====
====== Default Properties File Detection

Loading…
Cancel
Save