Changes for BAEL-1653

This commit is contained in:
Nikhil Khatwani 2018-03-28 13:10:09 +05:30
parent 70b5e9b403
commit 8b647650e2
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package org.baeldung.startup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class AppStartupRunner implements ApplicationRunner {
private static final Logger LOG = LoggerFactory.getLogger(AppStartupRunner.class);
public static int counter;
@Override
public void run(ApplicationArguments args) throws Exception {
LOG.info("Application started with option names : {}", args.getOptionNames());
LOG.info("Increment counter");
counter++;
}
}

View File

@ -0,0 +1,18 @@
package org.baeldung.startup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class CommandLineAppStartupRunner implements CommandLineRunner {
private static final Logger LOG = LoggerFactory.getLogger(CommandLineAppStartupRunner.class);
public static int counter;
@Override
public void run(String... args) throws Exception {
LOG.info("Increment counter");
counter++;
}
}