This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
Releases: yoozoo/protoconf-java
Releases · yoozoo/protoconf-java
protoconf-java - v0.2.3
protoconf-java - v0.2.2
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
- Add @protoconf Annotation support for Spring boot App
protoconf-java - v0.1.1
protoconf-java - A Java SDK for protoconf
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.