-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Wesley Hall opened SPR-10325 and commented
It doesn't appear to be possible to set up @PropertySource annotations that refer to non-existent files.
It can be quite useful to allow for optional configuration files, for example, ~/.application/application.properties to allow for the optional overriding of configuration properties on a per user basis. I might not have the file, but if I do, it's values should override the defaults.
It is possible to achieve this behaviour with 'setIgnoreResourceNotFound' on the PropertyPlaceholderConfigurer, but the new @PropertySource annotation will throw a FileNotFoudException and the application context fails to start.
Consider adding an attribute to @PropertySource to allow for this behaviour, and potentially a @PropertySources annotation which can be configured with an array of @PropertySource values to allow for file configuration on a per file basis.
Affects: 3.2.1
Issue Links:
- Add @PropertySources annotation and support ignoreResourceNotFound [SPR-8371] #13018 Add
@PropertySourcesannotation and support ignoreResourceNotFound ("duplicates")
11 votes, 10 watchers