From 1b7ccbce2aa0eb999a6b4507d95ecea3e7621c85 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 7 Jan 2025 16:09:37 +0100 Subject: [PATCH] Deprecate PathResource variant This commit deprecates the `PathResource` implementation variant in favor of `FileSystemResource`. This was already pointing to `FileSystemResource` as of Spring Framework 5.1 and we now consider this variant as deprecated. Closes gh-34206 --- .../src/main/java/org/springframework/core/io/PathResource.java | 2 ++ .../java/org/springframework/core/io/PathResourceTests.java | 1 + 2 files changed, 3 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/core/io/PathResource.java b/spring-core/src/main/java/org/springframework/core/io/PathResource.java index fb6ba958a14..e5f39a7f866 100644 --- a/spring-core/src/main/java/org/springframework/core/io/PathResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/PathResource.java @@ -56,7 +56,9 @@ import org.springframework.util.Assert; * @see java.nio.file.Path * @see java.nio.file.Files * @see FileSystemResource + * @deprecated since 7.0 in favor of {@link FileSystemResource} */ +@Deprecated(since = "7.0", forRemoval = true) public class PathResource extends AbstractResource implements WritableResource { private final Path path; diff --git a/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java b/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java index c096c9c8876..909e8a7f1e4 100644 --- a/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java @@ -50,6 +50,7 @@ import static org.mockito.Mockito.mock; * @author Juergen Hoeller * @author Arjen Poutsma */ +@SuppressWarnings("removal") class PathResourceTests { private static final String TEST_DIR =