Commit e76605ff authored by Marcus Eisele's avatar Marcus Eisele Committed by Andy Wilkinson

Add Log Output when DevTools restart is disabled

This covers the cases when:
  * An Java agent based reloader (e.g. JRebel) is being used
  * The reloader was disabled by using a system property

See gh-14807
parent 35bd4cfb
......@@ -16,6 +16,9 @@
package org.springframework.boot.devtools.restart;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
......@@ -35,10 +38,12 @@ import org.springframework.core.Ordered;
public class RestartApplicationListener
implements ApplicationListener<ApplicationEvent>, Ordered {
private int order = HIGHEST_PRECEDENCE;
private static final String ENABLED_PROPERTY = "spring.devtools.restart.enabled";
private static final Log logger = LogFactory.getLog(RestartApplicationListener.class);
private int order = HIGHEST_PRECEDENCE;
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ApplicationStartingEvent) {
......@@ -63,10 +68,17 @@ public class RestartApplicationListener
if (enabled == null || Boolean.parseBoolean(enabled)) {
String[] args = event.getArgs();
DefaultRestartInitializer initializer = new DefaultRestartInitializer();
boolean restartOnInitialize = !AgentReloader.isActive();
boolean restartOnInitialize = true;
if (AgentReloader.isActive()) {
logger.info(
"Restart disabled due to an agent-based reloader being active");
restartOnInitialize = false;
}
Restarter.initialize(args, false, initializer, restartOnInitialize);
}
else {
logger.info("Restart disabled due to System property '" + ENABLED_PROPERTY
+ "' set to false");
Restarter.disable();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment