Spring Cloud Starter Eureka Setup

时间:2017-12-21 17:31:00

标签: spring-cloud spring-cloud-netflix

我尝试按照Spring.io上的a tutorial link设置Spring Cloud Eureka。我得到服务器,但不是它的客户端。本教程使用Spring Boot 1.5.9.RELEASE。但http://mvnrepository.com/上没有Spring Cloud Starter Eureka的版本。所以,我尝试1.4.0和2.0.0.M2。我得到了

09:15:41.027 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: 
org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:166)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at com.example.gateway.GatewayApplication.main(GatewayApplication.java:30)

我做错了什么?

我使用Gradle作为构建工具。

1 个答案:

答案 0 :(得分:3)

对于Spring Cloud Finchley和Spring Boot 2,工件已重命名为spring-cloud-starter-netflix-eureka-client