diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 1bd8ba26faa..146f542e966 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -116,7 +117,7 @@ class ClassPathFileSystemWatcherTests { static class Listener implements ApplicationListener { - private List events = new ArrayList<>(); + private List events = new CopyOnWriteArrayList<>(); @Override public void onApplicationEvent(ClassPathChangedEvent event) {