Changes for BAEL-1653
This commit is contained in:
parent
70b5e9b403
commit
8b647650e2
|
@ -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…
Reference in New Issue