-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support resource patterns in @PropertySource
locations [SPR-16785]
#21325
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Comments
Stéphane Nicoll commented Juergen Hoeller I have a user claiming this setup works for @Value. Do you know why that is? |
Any update regarding this subject? |
@PropertySource
locations [SPR-16785]
sbrannen
added a commit
that referenced
this issue
Aug 16, 2023
sbrannen
added a commit
that referenced
this issue
Aug 16, 2023
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 was referenced Sep 3, 2023
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Pratapi Hemant Patel opened SPR-16785 and commented
Currently
@PropertySource
supports only absolute pathBut regex are not supported.
Affects: 4.3.16
Reference URL: https://stackoverflow.com/questions/50079355/add-all-properties-in-a-given-resources-folder-to-springs-environment-class
The text was updated successfully, but these errors were encountered: