From 7d5d9b3eb7aadd78768770bb131f397b3e539fbe Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 16 Nov 2018 18:40:42 +0200 Subject: [PATCH 1/2] update eureka code to boot 2 --- spring-cloud/pom.xml | 4 ++-- spring-cloud/spring-cloud-eureka/pom.xml | 3 ++- .../spring-cloud-eureka-client/pom.xml | 18 +++--------------- .../eureka/client/EurekaClientApplication.java | 3 --- .../spring-cloud-eureka-feign-client/pom.xml | 14 +++++++------- .../feign/client/FeignClientApplication.java | 4 +--- .../cloud/feign/client/GreetingClient.java | 8 +++++--- .../spring-cloud-eureka-server/pom.xml | 2 +- .../eureka-client/pom.xml | 2 +- .../src/main/resources/application.yml | 2 +- .../eureka-server/pom.xml | 2 +- .../pom.xml | 4 +++- .../zuul-server/pom.xml | 8 ++------ .../src/main/resources/application.properties | 5 +---- 14 files changed, 30 insertions(+), 49 deletions(-) diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 2fd15202e6..28db4a7a3d 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -57,8 +57,8 @@ Brixton.SR7 1.2.2.RELEASE 1.2.2.RELEASE - 1.2.3.RELEASE - 1.2.3.RELEASE + 2.0.2.RELEASE + 1.4.6.RELEASE 1.2.3.RELEASE 1.3.0.RELEASE 1.4.2.RELEASE diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index 37571bc29a..7f7e2650d5 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -23,7 +23,8 @@ - 1.4.2.RELEASE + 2.0.1.RELEASE + Finchley.SR2 diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index 8bc51adcab..0bf9547aff 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -20,32 +20,20 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client ${spring-cloud-starter-eureka.version} org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} + ${spring-boot.version} org.springframework.boot spring-boot-starter-test - 1.5.10.RELEASE + ${spring-boot.version} test - - org.springframework.boot - spring-boot-test - 1.5.10.RELEASE - test - - - org.springframework - spring-test - 4.0.5.RELEASE - test - diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java index 48099eeaa2..82b5f6acb1 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/java/com/baeldung/spring/cloud/eureka/client/EurekaClientApplication.java @@ -5,13 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Lazy; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication -@EnableEurekaClient @RestController public class EurekaClientApplication implements GreetingController { @Autowired diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml index 4552c458ec..d572b10d40 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml @@ -16,25 +16,25 @@ - - com.baeldung.spring.cloud - spring-cloud-eureka-client - ${spring-cloud-eureka-client.version} - org.springframework.cloud spring-cloud-starter-feign ${spring-cloud-starter-feign.version} + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + ${spring-cloud-starter-eureka.version} + org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} + ${spring-boot.version} org.springframework.boot spring-boot-starter-thymeleaf - ${spring-boot-starter-web.version} + ${spring-boot.version} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java index 7beb51d1ac..b8a6c8232d 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/FeignClientApplication.java @@ -3,14 +3,12 @@ package com.baeldung.spring.cloud.feign.client; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @SpringBootApplication -@EnableEurekaClient @EnableFeignClients @Controller public class FeignClientApplication { diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java index 6bd444b347..a9977d86d6 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/java/com/baeldung/spring/cloud/feign/client/GreetingClient.java @@ -1,8 +1,10 @@ package com.baeldung.spring.cloud.feign.client; -import com.baeldung.spring.cloud.eureka.client.GreetingController; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestMapping; @FeignClient("spring-cloud-eureka-client") -public interface GreetingClient extends GreetingController { +public interface GreetingClient { + @RequestMapping("/greeting") + String greeting(); } diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml index 8082b30c33..da2c50d3c7 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml @@ -18,7 +18,7 @@ org.springframework.cloud - spring-cloud-starter-eureka-server + spring-cloud-starter-netflix-eureka-server ${spring-cloud-starter-eureka.version} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml index 9c27affb8b..6a5b7ddb55 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml @@ -17,7 +17,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client ${spring-cloud-starter-eureka.version} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml index 9fa929e16b..903e34ce81 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml @@ -3,7 +3,7 @@ spring: name: spring-cloud-eureka-client server: - port: 8081 + port: 8082 eureka: client: diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml index d694c9058b..e3c5109a26 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml @@ -17,7 +17,7 @@ org.springframework.cloud - spring-cloud-starter-eureka-server + spring-cloud-starter-netflix-eureka-server ${spring-cloud-starter-eureka.version} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml index f4166c7d34..4d3687134f 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/pom.xml @@ -24,9 +24,11 @@ - 1.4.2.RELEASE + 2.0.1.RELEASE 1.10 1.2.10 + 2.0.1.RELEASE + Finchley.SR2 diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml index 103b8334d3..e64ceb501e 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml @@ -16,11 +16,11 @@ org.springframework.cloud - spring-cloud-starter-zuul + spring-cloud-starter-netflix-zuul org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client commons-configuration @@ -32,10 +32,6 @@ rxjava ${rxjava.version} - - org.springframework.boot - spring-boot-starter-security - diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties index cb1dca78c2..42b4f5eee4 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/application.properties @@ -3,7 +3,4 @@ spring.application.name=zuul-server eureka.instance.preferIpAddress=true eureka.client.registerWithEureka=true eureka.client.fetchRegistry=true -eureka.serviceurl.defaultzone=http://localhost:8761/eureka/ -management.security.enabled=false -security.basic.enabled=false -hystrix.command.default.execution.timeout.enabled=false +eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:8761/eureka} \ No newline at end of file From 874a7ca051fedcaf4a0cb276eec510490e3d6bcd Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 16 Nov 2018 18:58:12 +0200 Subject: [PATCH 2/2] fix port --- .../eureka-client/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml index 903e34ce81..9fa929e16b 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/application.yml @@ -3,7 +3,7 @@ spring: name: spring-cloud-eureka-client server: - port: 8082 + port: 8081 eureka: client: