Skip to content
Haruhi edited this page Oct 9, 2017 · 10 revisions

maven

<dependency>
  <groupId>com.dangdang</groupId>
  <artifactId>config-toolkit</artifactId>
  <version>3.1.6-RELEASE</version>
</dependency>

code

ZookeeperConfigProfile configProfile = new ZookeeperConfigProfile("zoo.host1:8181,zoo.host2:8181,zoo.host3:8181", "/projectx/modulex", "1.0.0");
GeneralConfigGroup propertyGroup1 = new ZookeeperConfigGroup(configProfile, "property-group1");

String stringProperty = propertyGroup1.get("string_property_key");
Preconditions.checkState("Config-Toolkit".equals(stringProperty));
String intProperty = propertyGroup1.get("int_property_key");
Preconditions.checkState(1123 == Integer.parseInt(intProperty));

demo

  • config-toolkit-demo工程中有丰富的代码示例
  • 运行示例前请先运行InitialScript

Clone this wiki locally