diff --git a/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java b/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java index b42e2649bb..f435f42a9d 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java @@ -172,9 +172,24 @@ public @interface TestPropertySource { * @ContextConfiguration * public class ExtendedTest extends BaseTest { * // ... - * } - * - * + * } + *

If {@code @TestPropertySource} is used as a {@linkplain Repeatable + * repeatable} annotation, the following special rules apply. + *

    + *
  1. All {@code @TestPropertySource} annotations at a given level in the + * test class hierarchy (i.e., directly present or meta-present on a test + * class) are considered to be local annotations, in contrast to + * {@code @TestPropertySource} annotations that are inherited from a + * superclass.
  2. + *
  3. All local {@code @TestPropertySource} annotations must declare the + * same value for the {@code inheritLocations} flag.
  4. + *
  5. The {@code inheritLocations} flag is not taken into account between + * local {@code @TestPropertySource} annotations. Specifically, the property + * source locations for one local annotation will be appended to the list of + * property source locations defined by previous local annotations. This + * allows a local annotation to extend the list of test property source + * locations, potentially overriding individual properties.
  6. + *
* @see #locations */ boolean inheritLocations() default true; @@ -232,8 +247,24 @@ public @interface TestPropertySource { * @ContextConfiguration * public class ExtendedTest extends BaseTest { * // ... - * } - * + * } + *

If {@code @TestPropertySource} is used as a {@linkplain Repeatable + * repeatable} annotation, the following special rules apply. + *

    + *
  1. All {@code @TestPropertySource} annotations at a given level in the + * test class hierarchy (i.e., directly present or meta-present on a test + * class) are considered to be local annotations, in contrast to + * {@code @TestPropertySource} annotations that are inherited from a + * superclass.
  2. + *
  3. All local {@code @TestPropertySource} annotations must declare the + * same value for the {@code inheritProperties} flag.
  4. + *
  5. The {@code inheritProperties} flag is not taken into account between + * local {@code @TestPropertySource} annotations. Specifically, inlined + * properties for one local annotation will be appended to the list of + * inlined properties defined by previous local annotations. This allows a + * local annotation to extend the list of inlined properties, potentially + * overriding individual properties.
  6. + *
* @see #properties */ boolean inheritProperties() default true;