Allow Devtools to be enabled irrespective of the launching ClassLoader

Closes gh-21424
This commit is contained in:
Andy Wilkinson
2020-11-12 11:24:29 +00:00
parent 30bc0ad96a
commit 6df10842d2
4 changed files with 59 additions and 7 deletions

View File

@@ -88,6 +88,14 @@ class RestartApplicationListenerTests {
assertThat(output).contains("Restart disabled due to System property");
}
@Test
void enableWithSystemProperty(CapturedOutput output) {
System.setProperty(ENABLED_PROPERTY, "true");
testInitialize(false);
assertThat(Restarter.getInstance()).hasFieldOrPropertyWithValue("enabled", true);
assertThat(output).contains("Restart enabled irrespective of application packaging due to System property");
}
private void testInitialize(boolean failed) {
Restarter.clearInstance();
RestartApplicationListener listener = new RestartApplicationListener();