This is an automated email from the ASF dual-hosted git repository.

hyunkun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-website.git


The following commit(s) were added to refs/heads/master by this push:
     new a52ad16  Add chinese version properties.md (#460)
a52ad16 is described below

commit a52ad168989098a08fd8a520389b550b997ba60a
Author: kowasaretaneko17 <1239407...@qq.com>
AuthorDate: Sat Aug 31 08:41:44 2019 +0800

    Add chinese version properties.md (#460)
---
 docs/zh-cn/user/configuration/properties.md | 37 +++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/docs/zh-cn/user/configuration/properties.md 
b/docs/zh-cn/user/configuration/properties.md
new file mode 100644
index 0000000..bd3368d
--- /dev/null
+++ b/docs/zh-cn/user/configuration/properties.md
@@ -0,0 +1,37 @@
+# 属性配置
+
+如果你的应用足够简单,例如,不需要多注册中心或多协议,并且需要在spring容器中共享配置,那么,我们可以直接使用 
`dubbo.properties`作为默认配置。
+
+Dubbo可以自动加载classpath根目录下的dubbo.properties,但是你同样可以使用JVM参数来指定路径:`-Ddubbo.properties.file=xxx.properties`。
+
+# 映射规则
+可以将xml的tag名和属性名组合起来,用‘.’分隔。每行一个属性。
+
+* `dubbo.application.name=foo` 相当于 `<dubbo:application name="foo" />` 
+* `dubbo.registry.address=10.20.153.10:9090` 相当于 `<dubbo:registry 
address="10.20.153.10:9090" /> `  
+
+如果在xml配置中有超过一个的tag,那么你可以使用‘id’进行区分。如果你不指定id,它将作用于所有tag。
+
+* `dubbo.protocol.rmi.port=1099` 相当于 `<dubbo:protocol id="rmi" name="rmi" 
port="1099" /> `
+* `dubbo.registry.china.address=10.20.153.10:9090` 相当于 `<dubbo:registry 
id="china" address="10.20.153.10:9090" />`
+
+如下,是一个典型的dubbo.properties配置样例。
+
+```properties
+dubbo.application.name=foo
+dubbo.application.owner=bar
+dubbo.registry.address=10.20.153.10:9090
+```
+
+## 重写与优先级
+![properties-override](https://github.com/apache/dubbo-website/blob/master/docs/en-us/user/sources/images/dubbo-properties-override.jpg)
+
+优先级从高到低:
+
+* JVM -D参数,当你部署或者启动应用时,它可以轻易地重写配置,比如,改变buddo协议端口;
+* XML, XML中的当前配置会重写dubbo.properties中的;
+* Properties,默认配置,仅仅作用于以上两者没有配置时。
+
+1:如果在classpath下有超过一个dubbo.properties文件,比如,两个jar包都各自包含了dubbo.properties,dubbo将随机选择一个加载,并且打印错误日志。
+
+2:如果 `id`没有在`protocol`中配置,将使用`name`作为默认属性。

Reply via email to