Skip to content

Commit ea38b32

Browse files
author
黎木健
committed
doc: add document
1 parent fdde93e commit ea38b32

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

docs/src/main/asciidoc/spring-cloud-zookeeper.adoc

+11-8
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,22 @@ https://github.com/spring-cloud/spring-cloud-config[Config Server and Client].
486486
Configuration is loaded into the Spring Environment during the special "`bootstrap`"
487487
phase. Configuration is stored in the `/config` namespace by default. Multiple
488488
`PropertySource` instances are created, based on the application's name and the active
489-
profiles, to mimic the Spring Cloud Config order of resolving properties. For example, an
490-
application with a name of `testApp` and with the `dev` profile has the following property
491-
sources created for it:
489+
profiles, to mimic the Spring Cloud Config order of resolving properties. What's more, it
490+
supports multiple business namespaces through `defaultContext`. For example, an application
491+
with a name of `testApp` and with the `dev`, with `namespace1,namespace2` defaultContext
492+
profile has the following property sources created for it:
492493

493494
* `config/testApp,dev`
494495
* `config/testApp`
495-
* `config/application,dev`
496-
* `config/application`
496+
* `config/namespace1,dev`
497+
* `config/namespace1`
498+
* `config/namespace2,dev`
499+
* `config/namespace2`
497500

498501
The most specific property source is at the top, with the least specific at the bottom.
499-
Properties in the `config/application` namespace apply to all applications that use
500-
zookeeper for configuration. Properties in the `config/testApp` namespace are available
501-
only to the instances of the service named `testApp`.
502+
Properties in the `config/testApp` namespace are only available to the instances of the service
503+
named "testApp". If you want to share the configuration with other applications, you can
504+
configure the same `defaultContext` like `namespace1` or `namespace2`.
502505

503506
Configuration is currently read on startup of the application. Sending a HTTP `POST`
504507
request to `/refresh` causes the configuration to be reloaded. Watching the configuration

spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperPropertySourceLocator.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
* "bootstrap" phase. Configuration is stored in the {@code /config} namespace by default.
4242
* Multiple {@code PropertySource} instances are created based on the application's name
4343
* and the active profiles that mimics the Spring Cloud Config order of resolving
44-
* properties.What's more,it supports multiple business namespaces through {@code defaultContext}.
45-
* For example, an application with the name "testApp",and with the "dev"
46-
* profile,with "namespace1,namespace2" defaultContext will have the following property sources
44+
* properties. What's more,it supports multiple business namespaces through {@code defaultContext}.
45+
* For example, an application with the name "testApp", and with the "dev"
46+
* profile, with "namespace1,namespace2" defaultContext will have the following property sources
4747
* created:
4848
*
4949
* <pre>{@code
@@ -55,11 +55,9 @@
5555
* config/namespace2
5656
* }</pre>
5757
*
58-
* The most specific property source is at the top, with the least specific at the bottom.
59-
* Properties is the {@code config/application} namespace are applicable to all
60-
* applications using zookeeper for configuration. Properties in the
61-
* {@code config/testApp} namespace are only available to the instances of the service
62-
* named "testApp".
58+
* Properties in the {@code config/testApp} namespace are only available to the instances of the service
59+
* named "testApp". If you want to share the configuration with other applications, you can configure the
60+
* same {@code defaultContext} like "namespace1" or "namespace2".
6361
*
6462
* @author Spencer Gibb
6563
* @author lemonJ

0 commit comments

Comments
 (0)