update eureka code to boot 2

This commit is contained in:
Loredana 2018-11-16 18:40:42 +02:00
parent eaa890aead
commit 7d5d9b3eb7
14 changed files with 30 additions and 49 deletions

View File

@ -57,8 +57,8 @@
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> <spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
<spring-cloud-starter-config.version>1.2.2.RELEASE</spring-cloud-starter-config.version> <spring-cloud-starter-config.version>1.2.2.RELEASE</spring-cloud-starter-config.version>
<spring-cloud-config-server.version>1.2.2.RELEASE</spring-cloud-config-server.version> <spring-cloud-config-server.version>1.2.2.RELEASE</spring-cloud-config-server.version>
<spring-cloud-starter-eureka.version>1.2.3.RELEASE</spring-cloud-starter-eureka.version> <spring-cloud-starter-eureka.version>2.0.2.RELEASE</spring-cloud-starter-eureka.version>
<spring-cloud-starter-feign.version>1.2.3.RELEASE</spring-cloud-starter-feign.version> <spring-cloud-starter-feign.version>1.4.6.RELEASE</spring-cloud-starter-feign.version>
<spring-cloud-starter-hystrix.version>1.2.3.RELEASE</spring-cloud-starter-hystrix.version> <spring-cloud-starter-hystrix.version>1.2.3.RELEASE</spring-cloud-starter-hystrix.version>
<spring-cloud-stream.version>1.3.0.RELEASE</spring-cloud-stream.version> <spring-cloud-stream.version>1.3.0.RELEASE</spring-cloud-stream.version>
<spring-boot-starter-web.version>1.4.2.RELEASE</spring-boot-starter-web.version> <spring-boot-starter-web.version>1.4.2.RELEASE</spring-boot-starter-web.version>

View File

@ -23,7 +23,8 @@
</parent> </parent>
<properties> <properties>
<spring-boot-maven-plugin.version>1.4.2.RELEASE</spring-boot-maven-plugin.version> <spring-boot.version>2.0.1.RELEASE</spring-boot.version>
<spring-cloud-dependencies.version>Finchley.SR2</spring-cloud-dependencies.version>
</properties> </properties>
</project> </project>

View File

@ -20,30 +20,18 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${spring-cloud-starter-eureka.version}</version> <version>${spring-cloud-starter-eureka.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-starter-web.version}</version> <version>${spring-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<version>1.5.10.RELEASE</version> <version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>1.5.10.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.0.5.RELEASE</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,13 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication @SpringBootApplication
@EnableEurekaClient
@RestController @RestController
public class EurekaClientApplication implements GreetingController { public class EurekaClientApplication implements GreetingController {
@Autowired @Autowired

View File

@ -16,25 +16,25 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency>
<groupId>com.baeldung.spring.cloud</groupId>
<artifactId>spring-cloud-eureka-client</artifactId>
<version>${spring-cloud-eureka-client.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId> <artifactId>spring-cloud-starter-feign</artifactId>
<version>${spring-cloud-starter-feign.version}</version> <version>${spring-cloud-starter-feign.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${spring-cloud-starter-eureka.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-starter-web.version}</version> <version>${spring-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>${spring-boot-starter-web.version}</version> <version>${spring-boot.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -3,14 +3,12 @@ package com.baeldung.spring.cloud.feign.client;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@SpringBootApplication @SpringBootApplication
@EnableEurekaClient
@EnableFeignClients @EnableFeignClients
@Controller @Controller
public class FeignClientApplication { public class FeignClientApplication {

View File

@ -1,8 +1,10 @@
package com.baeldung.spring.cloud.feign.client; package com.baeldung.spring.cloud.feign.client;
import com.baeldung.spring.cloud.eureka.client.GreetingController; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient("spring-cloud-eureka-client") @FeignClient("spring-cloud-eureka-client")
public interface GreetingClient extends GreetingController { public interface GreetingClient {
@RequestMapping("/greeting")
String greeting();
} }

View File

@ -18,7 +18,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>${spring-cloud-starter-eureka.version}</version> <version>${spring-cloud-starter-eureka.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -17,7 +17,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${spring-cloud-starter-eureka.version}</version> <version>${spring-cloud-starter-eureka.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,7 +3,7 @@ spring:
name: spring-cloud-eureka-client name: spring-cloud-eureka-client
server: server:
port: 8081 port: 8082
eureka: eureka:
client: client:

View File

@ -17,7 +17,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>${spring-cloud-starter-eureka.version}</version> <version>${spring-cloud-starter-eureka.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -24,9 +24,11 @@
</modules> </modules>
<properties> <properties>
<spring-boot-maven-plugin.version>1.4.2.RELEASE</spring-boot-maven-plugin.version> <spring-boot-maven-plugin.version>2.0.1.RELEASE</spring-boot-maven-plugin.version>
<commons-config.version>1.10</commons-config.version> <commons-config.version>1.10</commons-config.version>
<rxjava.version>1.2.10</rxjava.version> <rxjava.version>1.2.10</rxjava.version>
<spring-boot.version>2.0.1.RELEASE</spring-boot.version>
<spring-cloud-dependencies.version>Finchley.SR2</spring-cloud-dependencies.version>
</properties> </properties>
</project> </project>

View File

@ -16,11 +16,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-configuration</groupId> <groupId>commons-configuration</groupId>
@ -32,10 +32,6 @@
<artifactId>rxjava</artifactId> <artifactId>rxjava</artifactId>
<version>${rxjava.version}</version> <version>${rxjava.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>

View File

@ -3,7 +3,4 @@ spring.application.name=zuul-server
eureka.instance.preferIpAddress=true eureka.instance.preferIpAddress=true
eureka.client.registerWithEureka=true eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true eureka.client.fetchRegistry=true
eureka.serviceurl.defaultzone=http://localhost:8761/eureka/ eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:8761/eureka}
management.security.enabled=false
security.basic.enabled=false
hystrix.command.default.execution.timeout.enabled=false