spring_reference/IV. Spring Boot features/23.2. Accessing command lin...

6 lines
427 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 23.2. 访问命令行属性
默认情况下SpringApplication将任何可选的命令行参数以'--'开头,比如,--server.port=9000转化为property并将其添加到Spring Environment中。如上所述命令行属性总是优先于其他属性源。
如果你不想将命令行属性添加到Environment里你可以使用SpringApplication.setAddCommandLineProperties(false)来禁止它们。