feat(starter): support spring config server

support spring config server

BREAKING CHANGE: starter config

Signed-off-by: 赵安家 <anjia0532@gmail.com>
pull/2983/head
AnJia 4 years ago committed by 赵安家
parent 40c80d7582
commit 64b7266ad0

@ -64,8 +64,8 @@ spring:
#path to config - redisson.yaml
redisson:
config: classpath:redisson.yaml
configBlock: |
file: classpath:redisson.yaml
config: |
clusterServersConfig:
idleConnectionTimeout: 10000
connectTimeout: 10000

@ -111,17 +111,17 @@ public class RedissonAutoConfiguration {
timeout = (Integer)timeoutValue;
}
if (redissonProperties.getConfigBlock() != null) {
if (redissonProperties.getConfig() != null) {
try {
config = Config.fromYAML(redissonProperties.getConfigBlock());
config = Config.fromYAML(redissonProperties.getConfig());
} catch (IOException e) {
try {
config = Config.fromJSON(redissonProperties.getConfigBlock());
config = Config.fromJSON(redissonProperties.getConfig());
} catch (IOException e1) {
throw new IllegalArgumentException("Can't parse config", e1);
}
}
} else if (redissonProperties.getConfig() != null) {
} else if (redissonProperties.getFile() != null) {
try {
InputStream is = getConfigStream();
config = Config.fromYAML(is);

@ -28,7 +28,7 @@ public class RedissonProperties {
private String config;
private String configBlock;
private String file;
public String getConfig() {
return config;
@ -38,12 +38,11 @@ public class RedissonProperties {
this.config = config;
}
public String getConfigBlock() {
return configBlock;
public String getFile() {
return file;
}
public void setConfigBlock(String configBlock) {
this.configBlock = configBlock;
public void setFile(String file) {
this.file = file;
}
}

Loading…
Cancel
Save