Merge pull request #47 from jmirc/master
Throw an exception when sub folders are creating under the context
This commit is contained in:
@@ -22,12 +22,11 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
|
||||
import com.ecwid.consul.v1.ConsulClient;
|
||||
import com.ecwid.consul.v1.QueryParams;
|
||||
import com.ecwid.consul.v1.Response;
|
||||
import com.ecwid.consul.v1.kv.model.GetValue;
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -55,9 +54,10 @@ public class ConsulPropertySource extends EnumerablePropertySource<ConsulClient>
|
||||
|
||||
if (values != null) {
|
||||
for (GetValue getValue : values) {
|
||||
String key = getValue.getKey().replace(context, "").replace('/', '.');
|
||||
String value = getDecoded(getValue.getValue());
|
||||
if (StringUtils.hasText(key)) {
|
||||
String key = getValue.getKey();
|
||||
if (!StringUtils.endsWithIgnoreCase(key, "/")) {
|
||||
key = key.replace(context, "").replace('/', '.');
|
||||
String value = getDecoded(getValue.getValue());
|
||||
properties.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user