-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support resource patterns in @PropertySource
locations [SPR-16785]
#21325
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? |
sbrannen
changed the title
@PropertySource doesn't support regex paths like @PropertySource("classpath:prod/*.properties") [SPR-16785]
@PropertySource doesn't support path patterns like @PropertySource("classpath:prod/*.properties") [SPR-16785]
Jun 9, 2020
sbrannen
changed the title
@PropertySource doesn't support path patterns like @PropertySource("classpath:prod/*.properties") [SPR-16785]
@PropertySource doesn't support path patterns like "classpath:prod/*.properties" [SPR-16785]
Jun 9, 2020
sbrannen
added
the
in: core
Issues in core modules (aop, beans, core, context, expression)
label
Jun 9, 2020
sbrannen
changed the title
@PropertySource doesn't support path patterns like "classpath:prod/*.properties" [SPR-16785]
Support wildcard patterns in @PropertySource locations [SPR-16785]
Jun 9, 2020
sbrannen
added
the
status: pending-design-work
Needs design work before any code can be developed
label
Jun 9, 2020
Any update regarding this subject? |
jhoeller
removed
the
status: pending-design-work
Needs design work before any code can be developed
label
Aug 14, 2023
sbrannen
changed the title
Support wildcard patterns in @PropertySource locations [SPR-16785]
Support resource patterns in @PropertySource locations [SPR-16785]
Aug 16, 2023
sbrannen
changed the title
Support resource patterns in @PropertySource locations [SPR-16785]
Support resource patterns in Aug 16, 2023
@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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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: