Example usage for org.springframework.boot.context.event ApplicationStartingEvent getArgs

List of usage examples for org.springframework.boot.context.event ApplicationStartingEvent getArgs

Introduction

In this page you can find the example usage for org.springframework.boot.context.event ApplicationStartingEvent getArgs.

Prototype

public final String[] getArgs() 

Source Link

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   ww w. ja  v  a  2 s.com*/
        Restarter.initialize(args, false, initializer, restartOnInitialize);
    } else {
        logger.info("Restart disabled due to System property '" + ENABLED_PROPERTY + "' being set to false");
        Restarter.disable();
    }
}