Support resource patterns in @TestPropertySource locations

Inspired by the recently added support for resource patterns in
@PropertySource locations, this commit adds the same support for
resource locations in @TestPropertySource.

For example, assuming the `config` folder in the classpath contains
only 3 files matching the pattern `file?.properties`,

... the following:

@TestPropertySource("classpath:/config/file1.properties")
@TestPropertySource("classpath:/config/file2.properties")
@TestPropertySource("classpath:/config/file3.properties")

... or:

@TestPropertySource({
    "classpath:/config/file1.properties",
    "classpath:/config/file2.properties",
    "classpath:/config/file3.properties"
})

... can now be replaced by:

@TestPropertySource("classpath*:/config/file?.properties")

See gh-21325
Closes gh-31055
This commit is contained in:
Sam Brannen
2023-08-16 09:44:46 +02:00
parent 3a38bb48b5
commit 1f544f113a
7 changed files with 98 additions and 16 deletions

View File

@@ -0,0 +1 @@
from.p1 = 1

View File

@@ -0,0 +1 @@
from.p2 = 2

View File

@@ -0,0 +1 @@
from.p3 = 3