Merge pull request #3899 from khatwaniNikhil/BAEL-1653
Changes for BAEL-1653
This commit is contained in:
commit
de06e4f6be
@ -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++;
|
||||||
|
}
|
||||||
|
}
|
@ -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++;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user