Merge pull request #3899 from khatwaniNikhil/BAEL-1653

Changes for BAEL-1653
This commit is contained in:
Loredana Crusoveanu 2018-03-28 10:59:58 +03:00 committed by GitHub
commit de06e4f6be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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++;
}
}