Add support for spring.cloud.config.enabled=false
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.bootstrap.BootstrapApplicationListener;
|
||||
import org.springframework.cloud.config.client.ConfigClientProperties;
|
||||
@@ -95,6 +96,7 @@ public class PropertySourceBootstrapConfiguration implements
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty("spring.cloud.config.enabled")
|
||||
protected static class PropertySourceLocatorConfiguration {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
public class ConfigClientProperties {
|
||||
|
||||
public static final String PREFIX = "spring.cloud.config";
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
private String env = "default";
|
||||
|
||||
@@ -61,6 +63,14 @@ public class ConfigClientProperties {
|
||||
this.setEnv(StringUtils.arrayToCommaDelimitedString(profiles));
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return extractCredentials()[2];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user