Add Application for Spring to Run
This commit is contained in:
parent
eb1f958e06
commit
696d1f31bb
|
@ -0,0 +1,33 @@
|
|||
package com.usvisatrack.services;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application implements ApplicationRunner {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Application.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
logger.info("Application started with command-line arguments: {}", Arrays.toString(args.getSourceArgs()));
|
||||
logger.info("NonOptionArgs: {}", args.getNonOptionArgs());
|
||||
logger.info("OptionNames: {}", args.getOptionNames());
|
||||
|
||||
for (String name : args.getOptionNames()) {
|
||||
logger.info("arg-" + name + "=" + args.getOptionValues(name));
|
||||
}
|
||||
|
||||
boolean containsOption = args.containsOption("person.name");
|
||||
logger.info("Contains person.name: " + containsOption);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue