Merge remote-tracking branch 'origin/master' into 2.0.x
This commit is contained in:
@@ -33,7 +33,6 @@ Example Zookeeper client:
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@RestController
|
||||
public class Application {
|
||||
|
||||
@@ -63,7 +62,9 @@ CAUTION: If you use <<spring-cloud-zookeeper-config,Spring Cloud Zookeeper Confi
|
||||
|
||||
The default service name, instance id and port, taken from the `Environment`, are `${spring.application.name}`, the Spring Context ID and `${server.port}` respectively.
|
||||
|
||||
`@EnableDiscoveryClient` makes the app into both a Zookeeper "service" (i.e. it registers itself) and a "client" (i.e. it can query Zookeeper to locate other services).
|
||||
Having `spring-cloud-starter-zookeeper-discovery` on the classpath makes the app into both a Zookeeper "service" (i.e. it registers itself) and a "client" (i.e. it can query Zookeeper to locate other services).
|
||||
|
||||
If you would like to disable the Zookeeper Discovery Client you can set `spring.cloud.zookeeper.discovery.enabled` to `false`.
|
||||
|
||||
|
||||
=== Using the DiscoveryClient
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.x.discovery.ServiceDiscovery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.endpoint.Endpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -39,6 +40,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnBean(ZookeeperDiscoveryClientConfiguration.Marker.class)
|
||||
@ConditionalOnZookeeperDiscoveryEnabled
|
||||
@AutoConfigureBefore({CommonsClientAutoConfiguration.class, NoopDiscoveryClientAutoConfiguration.class})
|
||||
@AutoConfigureAfter({ZookeeperDiscoveryClientConfiguration.class})
|
||||
public class ZookeeperDiscoveryAutoConfiguration {
|
||||
|
||||
@Autowired(required = false)
|
||||
|
||||
@@ -18,11 +18,9 @@ package org.springframework.cloud.zookeeper.serviceregistry;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration;
|
||||
import org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties;
|
||||
import org.springframework.cloud.zookeeper.discovery.ConditionalOnZookeeperDiscoveryEnabled;
|
||||
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryAutoConfiguration;
|
||||
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
|
||||
@@ -37,13 +35,11 @@ import org.springframework.util.StringUtils;
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(AutoServiceRegistrationProperties.class)
|
||||
@ConditionalOnMissingBean(type = "org.springframework.cloud.zookeeper.discovery.ZookeeperLifecycle")
|
||||
@ConditionalOnZookeeperDiscoveryEnabled
|
||||
@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter(ZookeeperServiceRegistryAutoConfiguration.class)
|
||||
@AutoConfigureBefore({ AutoServiceRegistrationAutoConfiguration.class,
|
||||
ZookeeperDiscoveryAutoConfiguration.class })
|
||||
@AutoConfigureAfter( { ZookeeperServiceRegistryAutoConfiguration.class} )
|
||||
@AutoConfigureBefore( {AutoServiceRegistrationAutoConfiguration.class,ZookeeperDiscoveryAutoConfiguration.class} )
|
||||
public class ZookeeperAutoServiceRegistrationAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -9,11 +9,9 @@ org.springframework.cloud.zookeeper.discovery.dependency.ZookeeperDependenciesAu
|
||||
org.springframework.cloud.zookeeper.discovery.watcher.DependencyWatcherAutoConfiguration,\
|
||||
org.springframework.cloud.zookeeper.serviceregistry.ZookeeperAutoServiceRegistrationAutoConfiguration,\
|
||||
org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistryAutoConfiguration,\
|
||||
org.springframework.cloud.zookeeper.support.CuratorServiceDiscoveryAutoConfiguration
|
||||
org.springframework.cloud.zookeeper.support.CuratorServiceDiscoveryAutoConfiguration,\
|
||||
org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClientConfiguration
|
||||
|
||||
# Environment Post Processors
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
org.springframework.cloud.zookeeper.discovery.dependency.DependencyEnvironmentPostProcessor
|
||||
|
||||
org.springframework.cloud.client.discovery.EnableDiscoveryClient=\
|
||||
org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClientConfiguration
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -43,7 +42,6 @@ public class ZookeeperDiscoveryDisabledTests {
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableDiscoveryClient
|
||||
@Import(CommonTestConfig.class)
|
||||
static class SomeApp {
|
||||
@Bean
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.TestRibbonClient;
|
||||
@@ -58,7 +57,6 @@ public class ZookeeperDiscoveryHealthIndicatorWithNestedStructureTests {
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableDiscoveryClient
|
||||
@Import(CommonTestConfig.class)
|
||||
@Profile("nestedstructure")
|
||||
static class Config {
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -36,7 +35,6 @@ public class ZookeeperDiscoveryPropertiesTests {
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@Import(CommonTestConfig.class)
|
||||
@EnableDiscoveryClient
|
||||
static class Config {
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.netflix.ribbon.ServerIntrospector;
|
||||
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
|
||||
@@ -89,7 +88,6 @@ public class ZookeeperDiscoverySecurePortTests {
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@Import(CommonTestConfig.class)
|
||||
@EnableDiscoveryClient
|
||||
@Profile("ribbon")
|
||||
static class Config {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
@@ -118,7 +117,6 @@ public class ZookeeperDiscoveryTests {
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@Import(CommonTestConfig.class)
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(clients = { IdUsingFeignClient.class })
|
||||
@Profile("ribbon")
|
||||
static class Config {
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.zookeeper.discovery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.x.discovery.details.InstanceSerializer;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.TestRibbonClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.toomuchcoding.jsonassert.JsonPath;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
/**
|
||||
* Test for backwards compatibility
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = ZookeeperDiscoveryWithZookeeperLifecycleTests.Config.class,
|
||||
properties = "spring.application.name=testzkwithzookeeperlifecycle",
|
||||
webEnvironment = RANDOM_PORT)
|
||||
@ActiveProfiles("ribbon")
|
||||
public class ZookeeperDiscoveryWithZookeeperLifecycleTests {
|
||||
|
||||
@Autowired TestRibbonClient testRibbonClient;
|
||||
@Autowired DiscoveryClient discoveryClient;
|
||||
@Autowired ZookeeperServiceDiscovery serviceDiscovery;
|
||||
@Value("${spring.application.name}") String springAppName;
|
||||
|
||||
@Test public void should_find_the_app_by_its_name_via_Ribbon() {
|
||||
//expect:
|
||||
then(registeredServiceStatusViaServiceName()).isEqualTo("UP");
|
||||
}
|
||||
|
||||
@Test public void should_find_a_collaborator_via_discovery_client() {
|
||||
//given:
|
||||
List<ServiceInstance> instances = this.discoveryClient.getInstances(this.springAppName);
|
||||
ServiceInstance instance = instances.get(0);
|
||||
//expect:
|
||||
then(registeredServiceStatus(instance)).isEqualTo("UP");
|
||||
then(instance.getMetadata().get("testMetadataKey")).isEqualTo("testMetadataValue");
|
||||
}
|
||||
|
||||
@Test public void should_present_application_name_as_id_of_the_service_instance() {
|
||||
//given:
|
||||
ServiceInstance instance = this.discoveryClient.getLocalServiceInstance();
|
||||
//expect:
|
||||
then(this.springAppName).isEqualTo(instance.getServiceId());
|
||||
}
|
||||
|
||||
private String registeredServiceStatusViaServiceName() {
|
||||
return JsonPath.builder(this.testRibbonClient.thisHealthCheck()).field("status").read(String.class);
|
||||
}
|
||||
|
||||
private String registeredServiceStatus(ServiceInstance instance) {
|
||||
return JsonPath.builder(this.testRibbonClient.callOnUrl(instance.getHost()+":"+instance.getPort(), "health")).field("status").read(String.class);
|
||||
}
|
||||
|
||||
@Test public void should_properly_find_local_instance() {
|
||||
//expect:
|
||||
then(this.serviceDiscovery.getServiceInstanceRef().get().getAddress()).isEqualTo(this.discoveryClient.getLocalServiceInstance().getHost());
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@Import(CommonTestConfig.class)
|
||||
@Profile("ribbon")
|
||||
static class Config {
|
||||
@Bean
|
||||
public ZookeeperServiceDiscovery zookeeperServiceDiscovery(ZookeeperDiscoveryProperties properties, CuratorFramework curator,
|
||||
InstanceSerializer<ZookeeperInstance> instanceSerializer) {
|
||||
return new ZookeeperServiceDiscovery(curator, properties, instanceSerializer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ZookeeperLifecycle zookeeperLifecycle(ZookeeperDiscoveryProperties properties,
|
||||
ZookeeperServiceDiscovery serviceDiscovery) {
|
||||
return new ZookeeperLifecycle(properties, serviceDiscovery);
|
||||
}
|
||||
|
||||
@Bean TestRibbonClient testRibbonClient(@LoadBalanced RestTemplate restTemplate,
|
||||
@Value("${spring.application.name}") String springAppName) {
|
||||
return new TestRibbonClient(restTemplate, springAppName);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
@Profile("ribbon")
|
||||
class PingController {
|
||||
|
||||
@RequestMapping("/ping") String ping() {
|
||||
return "pong";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.zookeeper.discovery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = ZookeeperLifecycleRegistrationDisabledTests.TestPropsConfig.class,
|
||||
properties = { "spring.application.name=myTestNotRegisteredService",
|
||||
"spring.cloud.zookeeper.discovery.register=false", "spring.cloud.zookeeper.dependency.enabled=false"},
|
||||
webEnvironment = RANDOM_PORT)
|
||||
public class ZookeeperLifecycleRegistrationDisabledTests {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ZookeeperDiscoveryClient client;
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
List<ServiceInstance> instances = this.client.getInstances("myTestNotRegisteredService");
|
||||
assertTrue("service was registered", instances.isEmpty());
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@Import({ CommonTestConfig.class })
|
||||
static class TestPropsConfig { }
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportAutoCon
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -69,7 +68,7 @@ public class ZookeeprDiscoveryNonWebAppTests {
|
||||
clientApplication.setWebEnvironment(false);
|
||||
|
||||
try (ConfigurableApplicationContext producerContext = producerApp.run(this.connectionString, "--server.port=0",
|
||||
"--spring.application.name=hello-world")) {
|
||||
"--spring.application.name=hello-world", "--debug")) {
|
||||
try (final ConfigurableApplicationContext context = clientApplication.run(this.connectionString,
|
||||
"--spring.cloud.zookeeper.discovery.register=false")) {
|
||||
Awaitility.await().until(new Runnable() {
|
||||
@@ -91,7 +90,6 @@ public class ZookeeprDiscoveryNonWebAppTests {
|
||||
|
||||
@EnableAutoConfiguration(exclude = {EndpointMBeanExportAutoConfiguration.class,
|
||||
JmxAutoConfiguration.class})
|
||||
@EnableDiscoveryClient
|
||||
@Configuration
|
||||
static class HelloClient {
|
||||
@LoadBalanced
|
||||
@@ -108,7 +106,6 @@ public class ZookeeprDiscoveryNonWebAppTests {
|
||||
|
||||
@EnableAutoConfiguration(exclude = {EndpointMBeanExportAutoConfiguration.class,
|
||||
JmxAutoConfiguration.class})
|
||||
@EnableDiscoveryClient
|
||||
@RestController
|
||||
static class HelloProducer {
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(exclude = EndpointMBeanExportAutoConfiguration.class)
|
||||
@Import(CommonTestConfig.class)
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackageClasses = {AliasUsingFeignClient.class, IdUsingFeignClient.class})
|
||||
public class DependencyConfig {
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.zookeeper.ZookeeperProperties;
|
||||
@@ -77,7 +76,6 @@ public class StickyRuleTests {
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableDiscoveryClient
|
||||
@Profile("loadbalancerclient")
|
||||
static class Config {
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.TestRibbonClient;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -98,7 +97,6 @@ public class ZookeeperDiscoveryWithDyingDependenciesTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableDiscoveryClient
|
||||
@EnableAutoConfiguration
|
||||
@Import(DependencyConfig.class)
|
||||
static class Config { }
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.zookeeper.discovery.watcher.presence.DependencyPresenceOnStartupVerifier;
|
||||
import org.springframework.cloud.zookeeper.discovery.watcher.presence.LogMissingDependencyChecker;
|
||||
@@ -67,7 +66,6 @@ public class DefaultDependencyWatcherSpringTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableDiscoveryClient
|
||||
@EnableAutoConfiguration
|
||||
@Profile("watcher")
|
||||
static class Config {
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
|
||||
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
|
||||
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
|
||||
@@ -75,7 +74,6 @@ public class ZookeeperAutoServiceRegistrationTests {
|
||||
|
||||
@SpringBootConfiguration
|
||||
@EnableAutoConfiguration
|
||||
@EnableDiscoveryClient
|
||||
@Import({CommonTestConfig.class})
|
||||
/*@ImportAutoConfiguration({AutoServiceRegistrationAutoConfiguration.class, ZookeeperAutoServiceRegistration.class,
|
||||
ZookeeperServiceRegistryAutoConfiguration.class})*/
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
@@ -41,7 +40,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableDiscoveryClient
|
||||
@RestController
|
||||
@EnableFeignClients
|
||||
public class SampleZookeeperApplication {
|
||||
|
||||
Reference in New Issue
Block a user