Document precedence for @DynamicPropertySource

Closes gh-24837
This commit is contained in:
Sam Brannen
2020-04-01 17:56:58 +02:00
parent b7eb983107
commit a842434bff
4 changed files with 135 additions and 26 deletions

View File

@@ -41,8 +41,17 @@ import java.lang.annotation.Target;
* is resolved. Typically, method references are used to supply values, as in the
* following example.
*
* <h3>Example</h3>
* <h3>Precedence</h3>
* <p>Dynamic properties have higher precedence than those loaded from
* {@link TestPropertySource @TestPropertySource}, the operating system's
* environment, Java system properties, or property sources added by the
* application declaratively by using
* {@link org.springframework.context.annotation.PropertySource @PropertySource}
* or programmatically. Thus, dynamic properties can be used to selectively
* override properties loaded via {@code @TestPropertySource}, system property
* sources, and application property sources.
*
* <h3>Example</h3>
* <pre class="code">
* &#064;SpringJUnitConfig(...)
* &#064;Testcontainers

View File

@@ -44,7 +44,9 @@ import org.springframework.core.annotation.AliasFor;
* or some other means). Thus, test property sources can be used to selectively
* override properties defined in system and application property sources.
* Furthermore, inlined {@link #properties} have higher precedence than
* properties loaded from resource {@link #locations}.
* properties loaded from resource {@link #locations}. Note, however, that
* properties registered via {@link DynamicPropertySource @DynamicPropertySource}
* have higher precedence than those loaded via {@code @TestPropertySource}.
*
* <h3>Default Properties File Detection</h3>
* <p>If {@code @TestPropertySource} is declared as an <em>empty</em> annotation