Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Releases: yoozoo/protoconf-java

protoconf-java - v0.2.3

04 Dec 03:31
Compare
Choose a tag to compare
  1. Add watch spring cloud config change
  2. Add embeded spring cloud server
  3. Minor bug fix

protoconf-java - v0.2.2

22 Nov 08:36
Compare
Choose a tag to compare

Add Spring Cloud config support

  • config server side config
spring:
  profiles:
    active: protoconf
  cloud:
    config:
      server:
        protoconf:
          token: U2FsdGVkX19aPec6KYqLkVV4CWPy2iGfQHY6Pq4FwOqbssMXB7zlAC+KKbrPqFBf
server:
  port: 8888
  • config client side config
spring:
  application:
    name: 国内平台-测试CloudConfig
cloud:
  config:
    uri: http://localhost:8888

protoconf-java - v0.2.1

15 Nov 03:33
1bb28fe
Compare
Choose a tag to compare
  • Add @protoconf Annotation support for Spring boot App

protoconf-java - v0.1.1

01 Nov 10:13
Compare
Choose a tag to compare

protoconf-java - A Java SDK for protoconf

License
GitHub release

protoconf-java is the java sdk for protoconf .

Java Versions

Java 8 or above is required.

Download

Maven

Add dependency to pom.xml

<dependency>
  <groupId>com.yoozoo.protoconf</groupId>
  <artifactId>protoconf-java</artifactId>
  <version>${protoconf-java-version}</version>
</dependency>

Usage

// set app token
String appToken = "U2FsdGVkX1+EGNROfb41wAhtOumHKQPkli1FEL54C/U=";
EtcdReader etcdReader = new EtcdReader();
etcdReader.setAppToken(appToken);

// connect to etcd
ConfigurationReader configurationReader = new ConfigurationReader(etcdReader);

// fill in etcd values to config instance
configurationReader.config(Configuration.instance());

// watch config changes
Configuration.instance().watch_name(new ChangeListener() {
    @Override
    public void onChange(String newValue) {
        System.out.println("name has been changed to: " + newValue);
    }
});
configurationReader.watchKeys(Configuration.instance());

// get config value
dataSource.setUrl(Configuration.instance().get_mysqlDsn());
dataSource.setUsername(Configuration.instance().get_username());
dataSource.setPassword(Configuration.instance().get_password());

License

protoconf-java is under the Apache 2.0 license. See the LICENSE file for details.