diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerBootstrapApplicationListener.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerBootstrapApplicationListener.java index b1da3ebd..0545eaf8 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerBootstrapApplicationListener.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerBootstrapApplicationListener.java @@ -36,12 +36,18 @@ import org.springframework.core.env.PropertySource; * properties or a {@link SpringApplicationBuilder}). This is the same rule of precedence * as for anything else affecting the bootstrap process itself, e.g. setting * spring.cloud.bootstrap.name to something other than "bootstrap". - * + *

+ * N.B. a config server can always be an "embedded" config client (using its own config + * repository as a property source) if you set + * spring.cloud.config.server.bootstrap=true in bootstrap.yml + * bootstrap.yml. This listener is only to prevent it from using HTTP to contact + * itself. + * * @author Dave Syer * */ public class ConfigServerBootstrapApplicationListener implements - ApplicationListener, Ordered { +ApplicationListener, Ordered { public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 4; @@ -65,8 +71,8 @@ public class ConfigServerBootstrapApplicationListener implements ConfigurableEnvironment environment = event.getEnvironment(); if (!environment.resolvePlaceholders("${spring.cloud.config.enabled:false}") .equalsIgnoreCase("true")) { - if (!environment.getPropertySources().contains(propertySource.getName())) { - environment.getPropertySources().addLast(propertySource); + if (!environment.getPropertySources().contains(this.propertySource.getName())) { + environment.getPropertySources().addLast(this.propertySource); } } }