From b113cdaf85b6da7210663ea3b60e84e5b087b339 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Tue, 22 Sep 2020 12:29:03 -0400 Subject: [PATCH] polish --- .../config/ConsulConfigDataLocationResolver.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolver.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolver.java index 520bd6b6..54fb8de2 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolver.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolver.java @@ -84,9 +84,14 @@ public class ConsulConfigDataLocationResolver implements ConfigDataLocationResol @Override public List resolveProfileSpecific(ConfigDataLocationResolverContext resolverContext, String location, boolean optional, Profiles profiles) throws ConfigDataLocationNotFoundException { - UriComponents locationUri = parseLocation(resolverContext, location); + // create consul client + registerBean(resolverContext, ConsulProperties.class, loadProperties(resolverContext.getBinder(), locationUri)); + + registerAndPromoteBean(resolverContext, ConsulClient.class, this::createConsulClient); + + // create locations ConsulConfigProperties properties = loadConfigProperties(resolverContext.getBinder()); ConsulPropertySources consulPropertySources = new ConsulPropertySources(properties, log); @@ -95,12 +100,8 @@ public class ConsulConfigDataLocationResolver implements ConfigDataLocationResol ? consulPropertySources.getAutomaticContexts(profiles.getAccepted()) : getCustomContexts(locationUri, properties); - registerBean(resolverContext, ConsulProperties.class, loadProperties(resolverContext.getBinder(), locationUri)); - registerAndPromoteBean(resolverContext, ConsulConfigProperties.class, InstanceSupplier.of(properties)); - registerAndPromoteBean(resolverContext, ConsulClient.class, this::createConsulClient); - registerAndPromoteBean(resolverContext, ConsulConfigIndexes.class, InstanceSupplier.from(ConsulConfigDataIndexes::new));