From 640d6f5682e7b4a209fe9b303bd01d6cb9b0641f Mon Sep 17 00:00:00 2001 From: qibaoguang Date: Mon, 23 Mar 2015 23:51:54 +0800 Subject: [PATCH] =?UTF-8?q?Update=2063.3.=20Use=20=E2=80=98short=E2=80=99?= =?UTF-8?q?=20command=20line=20arguments.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../63.3. Use ‘short’ command line arguments.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/IX. ‘How-to’ guides/63.3. Use ‘short’ command line arguments.md b/IX. ‘How-to’ guides/63.3. Use ‘short’ command line arguments.md index e69de29..583462f 100644 --- a/IX. ‘How-to’ guides/63.3. Use ‘short’ command line arguments.md +++ b/IX. ‘How-to’ guides/63.3. Use ‘short’ command line arguments.md @@ -0,0 +1,9 @@ +### 63.3. 使用'short'命令行参数 + +有些人喜欢使用(例如)`--port=9000`代替`--server.port=9000`来设置命令行配置属性。你可以通过在application.properties中使用占位符来启用该功能,比如: +```java +server.port=${port:8080} +``` +**注**:如果你继承自`spring-boot-starter-parent` POM,为了防止和Spring-style的占位符产生冲突,`maven-resources-plugins`默认的过滤令牌(filter token)已经从`${*}`变为`@`(即`@maven.token@`代替了`${maven.token}`)。如果已经直接启用maven对application.properties的过滤,你可能也想使用[其他的分隔符](http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters)替换默认的过滤令牌。 + +**注**:在这种特殊的情况下,端口绑定能够在一个PaaS环境下工作,比如Heroku和Cloud Foundry,因为在这两个平台中`PORT`环境变量是自动设置的,并且Spring能够绑定`Environment`属性的大写同义词。