Document best practices for inlined properties in @TestPropertySource

This commit is contained in:
Sam Brannen
2023-08-16 17:27:18 +02:00
parent eb65939341
commit 279e6eb423
2 changed files with 68 additions and 6 deletions

View File

@@ -231,6 +231,17 @@ public @interface TestPropertySource {
* <li>{@code "key:value"}</li>
* <li>{@code "key value"}</li>
* </ul>
* <p><strong>WARNING</strong>: although properties can be defined using any
* of the above syntax variants and any number of spaces between the key and
* the value, it is recommended that you use one syntax variant and consistent
* spacing within your test suite &mdash; for example, consider always using
* {@code "key = value"} instead of {@code "key= value"}, {@code "key=value"},
* etc. Similarly, if you define inlined properties using <em>text blocks</em>
* you should consistently use text blocks for inlined properties throughout
* your test suite. The reason is that the exact strings you provide will be
* used to determine the key for the context cache. Consequently, to benefit
* from the context cache you must ensure that you define inlined properties
* consistently.
* <h4>Examples</h4>
* <pre class="code">
* &#47;&#47; Using an array of strings