Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FileSystemResource
uses the "old"java.io.File
instead of the "new"java.nio.file.Path
. One of the disadvantages is that it only works withthe default file system and not with custom ones. Since the minimum
requirement is still Java 6
FileSystemResource
can't be retrofitted(and no
#getPath
can be added toResource
).PathResource
PathResourceTests
Resource
with a reference toPathResource
PathResource
delegates to the underlying file system instead ofStringUtils
likeFileSystemResource
. It has therefore slightlydifferent semantics. First when building relative resources via
#createRelative
the relative path will apply to this path (like URL orUnix). If the same switchable behavior like
FileSystemResource
iswanted that could be done with a boolean switch. Second equality is
delegated to the underlying file system provider so it's
case-insensitive on Windows.
PathResourceTests
contains only minimal tests(
FileSystemResource
has no tests) as writing tests forfile code is tricky. I could write more elaborate tests using
https://github.com/marschall/memoryfilesystem if that's wanted and OK.
I did sign the Spring CLA
Issue: SPR-10608