当使用application.properties定义的属性时,Spring会先通过已经存在的Environment查找该属性,所以你可以引用事先定义的值(比如,系统属性):
application.properties
Environment
app.name=MyApp app.description=${app.name} is a Spring Boot application
注 你也可以使用该技巧为存在的Spring Boot属性创建'短'变量,具体参考Section 69.4, “Use ‘short’ command line arguments”arrow-up-right。
Last updated 7 years ago
Was this helpful?