diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java index 341a7c62b60..539d1818084 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java @@ -76,7 +76,9 @@ public class JarFileRemoteApplicationLauncher extends RemoteApplicationLauncher file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1) .replace("\\", "/") + (file.isDirectory() ? "/" : ""))); if (file.isFile()) { - StreamUtils.copy(new FileInputStream(file), output); + try (FileInputStream input = new FileInputStream(file)) { + StreamUtils.copy(input, output); + } } output.closeEntry(); }