23.7 Application 인자에 접근하기
import org.springframework.boot.*
import org.springframework.beans.factory.annotation.*
import org.springframework.stereotype.*
@Component
public class MyBean {
@Autowired
public MyBean(ApplicationArguments args) {
boolean debug = args.containsOption("debug");
List<String> files = args.getNonOptionArgs();
// if run with "--debug logfile.txt" debug=true, files=["logfile.txt"]
}
}Last updated
Was this helpful?
![[팁]](https://wannaqueen.gitbook.io/spring5/~gitbook/image?url=https%3A%2F%2Fdocs.spring.io%2Fspring-boot%2Fdocs%2Fcurrent%2Freference%2Fhtmlsingle%2Fimages%2Ftip.png&width=300&dpr=3&quality=100&sign=e19e9545&sv=2)