From f19c7fbbe2333dd474da0a7785bf5359874676e2 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 6 Aug 2018 10:25:36 -0400 Subject: [PATCH 1/5] Exclude Netty dependencies. Fixes #3119 --- pom.xml | 20 +++++++++---------- .../pom.xml | 10 ++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 9c7ba0c6c..6fa53c729 100644 --- a/pom.xml +++ b/pom.xml @@ -120,16 +120,16 @@ pom import - - io.netty - netty-codec-http - ${netty.version} - - - io.netty - netty-transport-native-epoll - ${netty.version} - + + + + + + + + + + com.fasterxml.jackson.dataformat jackson-dataformat-smile diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml index 7ff7f124f..c07099c67 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml @@ -33,6 +33,16 @@ com.netflix.ribbon ribbon + + + io.netty + netty-codec-http + + + io.netty + netty-transport-native-epoll + + com.netflix.ribbon From d98b3ce3d6a4890f94bf1645f76f29765461503a Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 6 Aug 2018 10:27:46 -0400 Subject: [PATCH 2/5] Remove commented out lines --- pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pom.xml b/pom.xml index 6fa53c729..8dc86a83e 100644 --- a/pom.xml +++ b/pom.xml @@ -120,16 +120,6 @@ pom import - - - - - - - - - - com.fasterxml.jackson.dataformat jackson-dataformat-smile From 46719c0c313af828297babedac5614f7a728df5d Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 13 Aug 2018 14:08:55 -0400 Subject: [PATCH 3/5] Fix invalid URI error when Feign request URI does not end in / (#3136) * Fix invalid URI error when Feign request URI does not end in / --- .../netflix/feign/ribbon/LoadBalancerFeignClient.java | 8 +++++++- .../netflix/feign/ribbon/FeignRibbonClientTests.java | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java index 37d7f662b..0be90266f 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java @@ -97,7 +97,13 @@ public class LoadBalancerFeignClient implements Client { } static URI cleanUrl(String originalUrl, String host) { - return URI.create(originalUrl.replaceFirst(host, "")); + String newUrl = originalUrl.replaceFirst(host, ""); + StringBuffer buffer = new StringBuffer(newUrl); + if((newUrl.startsWith("https://") && newUrl.length() == 8) || + (newUrl.startsWith("http://") && newUrl.length() == 7)) { + buffer.append("/"); + } + return URI.create(buffer.toString()); } private FeignLoadBalancer lbClient(String clientName) { diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientTests.java index 676ca3075..aadd8a0ce 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientTests.java @@ -102,6 +102,16 @@ public class FeignRibbonClientTests { any(Options.class)); } + @Test + public void remoteRequestIsSentAtRoot() throws Exception { + Request request = new RequestTemplate().method("GET").append("http://foo") + .request(); + this.client.execute(request, new Options()); + RequestMatcher matcher = new RequestMatcher("http://foo.com:8000/"); + verify(this.delegate).execute(argThat(matcher), + any(Options.class)); + } + @Test public void remoteRequestIsSecure() throws Exception { Request request = new RequestTemplate().method("GET").append("https://foo/") From 81579f522faf00bf41ae8d043e0a121b8822adae Mon Sep 17 00:00:00 2001 From: Dennis Effing Date: Wed, 26 Sep 2018 22:22:40 +0200 Subject: [PATCH 4/5] Fix for #1251 (#3211) Example uses the same value of eureka.client.serviceUrl.defaultZone for all peers. The eureka server knows who it is and doesn't attempt to replicate to itself [1], so this simplification will work. [1]https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L616-L619 Cherry picked from commit 4b40a45 --- .../main/asciidoc/spring-cloud-netflix.adoc | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc index 186bec520..0dc794d79 100644 --- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc +++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc @@ -507,10 +507,37 @@ on a machine that knows its own hostname (it is looked up using `java.net.InetAddress` by default). You can add multiple peers to a system, and as long as they are all -connected to each other by at least one edge, they will synchronize -the registrations amongst themselves. If the peers are physically -separated (inside a data centre or between multiple data centres) then -the system can in principle survive split-brain type failures. +directly connected to each other, they will synchronize +the registrations amongst themselves. + +.application.yml (Three Peer Aware Eureka Servers) +---- +eureka: + client: + serviceUrl: + defaultZone: http://peer1/eureka/,http://peer2/eureka/,http://peer3/eureka/ + +--- +spring: + profiles: peer1 +eureka: + instance: + hostname: peer1 + +--- +spring: + profiles: peer2 +eureka: + instance: + hostname: peer2 + +--- +spring: + profiles: peer3 +eureka: + instance: + hostname: peer3 +---- === Prefer IP Address From 482deb04859affa881f904378eef34f5e7c02d90 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Tue, 2 Oct 2018 09:43:06 -0400 Subject: [PATCH 5/5] Adds additional-spring-configuration-metadata. Fixes #3164 --- ...itional-spring-configuration-metadata.json | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 spring-cloud-netflix-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json diff --git a/spring-cloud-netflix-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-netflix-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 000000000..5f29c879e --- /dev/null +++ b/spring-cloud-netflix-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,64 @@ +{ + "properties": [ + { + "defaultValue": "true", + "name": "archaius.propagate.environmentChangedEvent", + "description": "Propagates EnvironmentChanged events to Archaius ConfigurationManager.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "eureka.client.healthcheck.enabled", + "description": "Enables the Eureka health check handler.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": "true", + "name": "management.metrics.binders.hystrix.enabled", + "description": "Enables creation of OK Http Client factory beans.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": false, + "name": "hystrix.shareSecurityContext", + "description": "Enables auto-configuration of the Hystrix concurrency strategy plugin hook who will transfer the `SecurityContext` from your main thread to the one used by the Hystrix command.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": false, + "name": "ribbon.restclient.enabled", + "description": "Enables the use of the deprecated Ribbon RestClient.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": false, + "name": "ribbon.http.client.enabled", + "description": "Deprecated property to enable Ribbon RestClient.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "ribbon.eureka.enabled", + "description": "Enables the use of Eureka with Ribbon.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": false, + "name": "ribbon.okhttp.enabled", + "description": "Enables the use of the OK HTTP Client with Ribbon.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "turbine.stream.enabled", + "description": "Enables Autoconfiguration for a Spring Cloud Turbine using Spring Cloud Stream.", + "type": "java.lang.Boolean" + }, + { + "defaultValue": false, + "name": "zuul.ribbon.eager-load.enabled", + "description": "Enables eager loading of Ribbon clients on startup.", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file