From 010d29c124db015ae42cc405de9690a0e1602bb2 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 30 Oct 2014 07:17:02 +0000 Subject: [PATCH] Fix application name always being "bootstrap" --- .../cloud/bootstrap/BootstrapApplicationListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-cloud-config-client/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java b/spring-cloud-config-client/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java index 4fc6894c..005b8a34 100644 --- a/spring-cloud-config-client/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java +++ b/spring-cloud-config-client/src/main/java/org/springframework/cloud/bootstrap/BootstrapApplicationListener.java @@ -98,8 +98,8 @@ public class BootstrapApplicationListener implements if (StringUtils.hasText(configLocation)) { bootstrapMap.put("spring.config.location", configName); } - bootstrapMap.put("spring.application.name", configName); - bootstrapProperties.addFirst(new MapPropertySource(BOOTSTRAP_PROPERTY_SOURCE_NAME, bootstrapMap)); + bootstrapProperties.addFirst(new MapPropertySource( + BOOTSTRAP_PROPERTY_SOURCE_NAME, bootstrapMap)); bootstrapProperties.addFirst(new MapPropertySource("bootstrapInProgress", Collections. emptyMap())); for (PropertySource source : environment.getPropertySources()) { @@ -112,7 +112,8 @@ public class BootstrapApplicationListener implements // TODO: is it possible or sensible to share a ResourceLoader? SpringApplicationBuilder builder = new SpringApplicationBuilder() .profiles(environment.getActiveProfiles()).showBanner(false) - .environment(bootstrapEnvironment).web(false); + .environment(bootstrapEnvironment) + .properties("spring.application.name:" + configName).web(false); List> sources = new ArrayList>(); for (String name : names) { Class cls = ClassUtils.resolveClassName(name, null);