diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java index a8b9eb518b..e5ce01b2aa 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java @@ -62,7 +62,7 @@ public class RestarterTests { @Before public void setup() { - Restarter.setInstance(new TestableRestarter()); + RestarterInitializer.setRestarterInstance(); } @After @@ -176,6 +176,13 @@ public class RestarterTests { assertThat(Restarter.getInstance().getInitialUrls()).isEqualTo(urls); } + @FunctionalInterface + private interface WithMainAction { + + void perform() throws Exception; + + } + @Component @EnableScheduling public static class SampleApplication { @@ -272,4 +279,16 @@ public class RestarterTests { } + static class RestarterInitializer { + + static void setRestarterInstance() { + main(new String[0]); + } + + static void main(String[] args) { + Restarter.setInstance(new TestableRestarter()); + } + + } + }