24.2 Accessing Command Line Properties

默认情况下,SpringApplication将转换任何命令行选项参数(参数以--开头,例如--server.port=9000)为属性并将他们添加到Spring环境中. 如前所述,命令行属性总是优先于其他属性来源.

如果你不想要命令行属性被添加到环境中,您可以调用使用SpringApplication.setAddCommandLineProperties(false)来禁用它们.