From 67c0aa9dbf8a7d87e7b7eefe8cd59a4ca8253738 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 17 Jul 2014 08:26:10 +0100 Subject: [PATCH] Ensure /refresh reloads bootstrap configurations Some changes a while back had switched off refreshing the bootstrap config (because of the way it was being detected in an existing environment to prevent an infinite loop). This change fixes that by adding a dummy property source during bootstrap and then removing it again. --- .../platform/bootstrap/BootstrapApplicationListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-platform-config-client/src/main/java/org/springframework/platform/bootstrap/BootstrapApplicationListener.java b/spring-platform-config-client/src/main/java/org/springframework/platform/bootstrap/BootstrapApplicationListener.java index dc55f9a3..e65fe6ea 100644 --- a/spring-platform-config-client/src/main/java/org/springframework/platform/bootstrap/BootstrapApplicationListener.java +++ b/spring-platform-config-client/src/main/java/org/springframework/platform/bootstrap/BootstrapApplicationListener.java @@ -66,7 +66,7 @@ public class BootstrapApplicationListener implements if (environment instanceof ConfigurableEnvironment) { ConfigurableEnvironment configurable = (ConfigurableEnvironment) environment; // don't listen to events in a bootstrap context - if (configurable.getPropertySources().contains("bootstrap")) { + if (configurable.getPropertySources().contains("bootstrapInProgress")) { return; } ConfigurableApplicationContext context = bootstrapServiceContext( @@ -82,6 +82,7 @@ public class BootstrapApplicationListener implements for (PropertySource source : bootstrapProperties) { bootstrapProperties.remove(source.getName()); } + bootstrapProperties.addFirst(new MapPropertySource("bootstrapInProgress", Collections.emptyMap())); for (PropertySource source : environment.getPropertySources()) { bootstrapProperties.addLast(source); } @@ -100,6 +101,7 @@ public class BootstrapApplicationListener implements final ConfigurableApplicationContext context = builder.run(); // Make the bootstrap context a parent of the app context addAncestorInitializer(application, context); + bootstrapProperties.remove("bootstrapInProgress"); return context; }