diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java index a8b4e80dca..6a4547fe4b 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java @@ -232,7 +232,9 @@ public class FileSystemWatcher { Thread thread = this.watchThread; if (thread != null) { this.remainingScans.set(remainingScans); - thread.interrupt(); + if (remainingScans <= 0) { + thread.interrupt(); + } if (Thread.currentThread() != thread) { try { thread.join();