2
스프링 부트 문서 (Spring Boot Document)를 읽고, 스프링 부트를 배웠다. 23.6 액세스 응용 프로그램 인수에서, 그것은 ApplicationArguments에 대해 이야기하고, 코드는 다음과 같습니다스프링 부트에서 ApplicationArguments를 사용하는 방법
"["--debug logfile.txt 여기서 "디버그 = 사실, 파일 = 실행 경우는 말한다package com.example.project;
import org.springframework.boot.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
import java.util.*;
@Component
public class MyBean {
@Autowired
public MyBean(ApplicationArguments args) {
boolean debug = args.containsOption("debug");
List<String> files = args.getNonOptionArgs();
System.out.println(debug);
System.out.println(files);
}
}
logfile.txt "].
하지만 내 프로젝트에서는 어떻게 실행해야할지 모르겠다. Maven을 사용하여 스프링 부트를 만듭니다. 프로젝트 구조