From 1f124eb87943c9b8ef60f0ef940c69e5f9f3543d Mon Sep 17 00:00:00 2001 From: spencergibb Date: Tue, 22 Sep 2020 13:42:48 -0400 Subject: [PATCH] formatting --- .../ConsulConfigServerBootstrapper.java | 4 ++-- .../ConsulConfigServerBootstrapperTests.java | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapper.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapper.java index dee5bf73..c7a8b6f1 100644 --- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapper.java +++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapper.java @@ -62,8 +62,8 @@ public class ConsulConfigServerBootstrapper implements Bootstrapper { registry.addCloseListener(event -> { ConsulDiscoveryClient discoveryClient = event.getBootstrapContext().get(ConsulDiscoveryClient.class); if (discoveryClient != null) { - event.getApplicationContext().getBeanFactory() - .registerSingleton("consulDiscoveryClient", discoveryClient); + event.getApplicationContext().getBeanFactory().registerSingleton("consulDiscoveryClient", + discoveryClient); } }); registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, context -> { diff --git a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapperTests.java b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapperTests.java index 37ea7cb3..3e880d55 100644 --- a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapperTests.java +++ b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/configclient/ConsulConfigServerBootstrapperTests.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.config.client.ConfigServerInstanceProvider; import org.springframework.cloud.consul.discovery.ConsulDiscoveryClient; import org.springframework.context.ConfigurableApplicationContext; @@ -48,15 +47,15 @@ public class ConsulConfigServerBootstrapperTests { public void enabledAddsInstanceProviderFn() { AtomicReference bootstrapDiscoveryClient = new AtomicReference<>(); ConfigurableApplicationContext context = new SpringApplicationBuilder(TestConfig.class) - .properties("--server.port=0", "spring.cloud.config.discovery.enabled=true", - "spring.cloud.service-registry.auto-registration.enabled=false") - .addBootstrapper(registry -> registry.addCloseListener(event -> { - bootstrapDiscoveryClient.set(event.getBootstrapContext().get(ConsulDiscoveryClient.class)); - ConfigServerInstanceProvider.Function providerFn = event.getBootstrapContext() - .get(ConfigServerInstanceProvider.Function.class); - assertThat(providerFn).as("ConfigServerInstanceProvider.Function was not created when it should.") - .isNotNull(); - })).run(); + .properties("--server.port=0", "spring.cloud.config.discovery.enabled=true", + "spring.cloud.service-registry.auto-registration.enabled=false") + .addBootstrapper(registry -> registry.addCloseListener(event -> { + bootstrapDiscoveryClient.set(event.getBootstrapContext().get(ConsulDiscoveryClient.class)); + ConfigServerInstanceProvider.Function providerFn = event.getBootstrapContext() + .get(ConfigServerInstanceProvider.Function.class); + assertThat(providerFn).as("ConfigServerInstanceProvider.Function was not created when it should.") + .isNotNull(); + })).run(); ConsulDiscoveryClient discoveryClient = context.getBean(ConsulDiscoveryClient.class); assertThat(discoveryClient == bootstrapDiscoveryClient.get()).isTrue(); context.close();