Check exception cause for @PropertySource(ignoreResourceNotFound) support

Prior to this commit, the ignoreResourceNotFound flag in
@PropertySource was ignored by PropertySourceProcessor if a
PropertySourceFactory threw an exception which wrapped an exception
that would otherwise be ignored -- for example, a FileNotFoundException.

To address this issue, this commit updates PropertySourceFactory so
that it catches RuntimeException and IOException and then checks if the
exception or its cause is an "ignorable" exception in terms of
ignoreResourceNotFound semantics.

Closes gh-22276
This commit is contained in:
Sam Brannen
2023-08-05 09:59:24 +03:00
parent 1451f30781
commit 4a81814dbb
3 changed files with 199 additions and 3 deletions