@@ -150,6 +150,10 @@ Other methods let you obtain an actual `URL` or `File` object representing the
150
150
resource (if the underlying implementation is compatible and supports that
151
151
functionality).
152
152
153
+ Some implementations of the `Resource` interface also implement the extended
154
+ {api-spring-framework}/core/io/WritableResource.html[`WritableResource`] interface
155
+ for a resource that supports writing to it.
156
+
153
157
Spring itself uses the `Resource` abstraction extensively, as an argument type in
154
158
many method signatures when a resource is needed. Other methods in some Spring APIs
155
159
(such as the constructors to various `ApplicationContext` implementations) take a
@@ -174,11 +178,13 @@ work.
174
178
[[resources-implementations]]
175
179
== Built-in Resource Implementations
176
180
177
- Spring includes the following `Resource` implementations:
181
+ Spring includes several built-in `Resource` implementations, including but not limited to
182
+ the following:
178
183
179
184
* <<resources-implementations-urlresource>>
180
185
* <<resources-implementations-classpathresource>>
181
186
* <<resources-implementations-filesystemresource>>
187
+ * <<resources-implementations-pathresource>>
182
188
* <<resources-implementations-servletcontextresource>>
183
189
* <<resources-implementations-inputstreamresource>>
184
190
* <<resources-implementations-bytearrayresource>>
@@ -229,8 +235,21 @@ creates a `ClassPathResource` in that case.
229
235
[[resources-implementations-filesystemresource]]
230
236
=== `FileSystemResource`
231
237
232
- This is a `Resource` implementation for `java.io.File` and `java.nio.file.Path` handles.
233
- It supports resolution as a `File` and as a `URL`.
238
+ This is a `Resource` implementation for `java.io.File` handles. It also supports
239
+ `java.nio.file.Path` handles, applying Spring's standard String-based path
240
+ transformations but performing all operations via the `java.nio.file.Files` API. For pure
241
+ `java.nio.path.Path` based support use a `PathResource` instead. `FileSystemResource`
242
+ supports resolution as a `File` and as a `URL`.
243
+
244
+
245
+ [[resources-implementations-pathresource]]
246
+ === `PathResource`
247
+
248
+ This is a `Resource` implementation for `java.nio.file.Path` handles, performing all
249
+ operations and transformations via the `Path` API. It supports resolution as a `File` and
250
+ as a `URL` and also implements the extended `WritableResource` interface. `PathResource`
251
+ is effectively a pure `java.nio.path.Path` based alternative to `FileSystemResource` with
252
+ different `createRelative` behavior.
234
253
235
254
236
255
0 commit comments