Example usage for org.springframework.boot.devtools.restart AgentReloader isActive

List of usage examples for org.springframework.boot.devtools.restart AgentReloader isActive

Introduction

In this page you can find the example usage for org.springframework.boot.devtools.restart AgentReloader isActive.

Prototype

public static boolean isActive() 

Source Link

Document

Determine if any agent reloader is active.

Usage

From source file:org.springframework.boot.devtools.restart.RestartApplicationListener.java

private void onApplicationStartingEvent(ApplicationStartingEvent event) {
    // It's too early to use the Spring environment but we should still allow
    // users to disable restart using a System property.
    String enabled = System.getProperty(ENABLED_PROPERTY);
    if (enabled == null || Boolean.parseBoolean(enabled)) {
        String[] args = event.getArgs();
        DefaultRestartInitializer initializer = new DefaultRestartInitializer();
        boolean restartOnInitialize = !AgentReloader.isActive();
        if (!restartOnInitialize) {
            logger.info("Restart disabled due to an agent-based reloader being active");
        }//from w  w  w  .  j a v a2 s  .c o m
        Restarter.initialize(args, false, initializer, restartOnInitialize);
    } else {
        logger.info("Restart disabled due to System property '" + ENABLED_PROPERTY + "' being set to false");
        Restarter.disable();
    }
}