更新 Spring 项目启动程序

This commit is contained in:
YuCheng Hu 2022-10-03 00:12:00 -04:00
parent 1b57cdb7c7
commit fe062a709a
1 changed files with 27 additions and 4 deletions

View File

@ -1,13 +1,36 @@
package com.ossez.spring.security;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootSecurityJwtApplication {
import java.util.Arrays;
/**
* SPRING APPLICATION
*
* @author YuCheng Hu
*/
@SpringBootApplication
@Slf4j
public class SpringBootSecurityJwtApplication implements ApplicationRunner {
public static void main(String[] args) {
SpringApplication.run(SpringBootSecurityJwtApplication.class, args);
}
@Override
public void run(ApplicationArguments args) {
log.info("Application started with command-line arguments: {}", Arrays.toString(args.getSourceArgs()));
log.info("NonOptionArgs: {}", args.getNonOptionArgs());
log.info("OptionNames: {}", args.getOptionNames());
for (String name : args.getOptionNames()) {
log.info("arg-" + name + "=" + args.getOptionValues(name));
}
boolean containsOption = args.containsOption("person.name");
log.info("Contains person.name: " + containsOption);
}
}