BAEL-3689: Add missing code examples (#10282)

This commit is contained in:
kwoyke
2020-11-27 11:22:00 +01:00
committed by GitHub
parent adb449dcee
commit a6503a1f29
5 changed files with 15 additions and 2 deletions

View File

@@ -1,20 +0,0 @@
package com.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

@@ -1,18 +0,0 @@
package com.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++;
}
}