当前位置: 首页 > 知识库问答 >
问题:

Spring Cloud Starter尤里卡设置

梁研
2023-03-14

我试图通过Spring.io上的教程链接来设置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个答案

赵高韵
2023-03-14

对于Spring Cloud Finchley和Spring Boot 2,该工件已被重命名为< code > Spring-Cloud-starter-网飞-尤里卡-客户端

 类似资料:
  • 我正在尝试使用Spring和Spring Boot学习微服务,并学习部署到云平台。我计划创建一个Angular 2前端应用程序,它与我部署的微服务进行通信。现在,我正在浏览Spring cloud services Eureka、Zuul、Recural breakers等。 null

  • 我正在尝试向尤里卡服务器注册我的微服务。但它显示浏览器中没有可用的实例。我在控制台中没有收到任何错误。请帮助我解决这个问题。 我已经通过在谷歌上搜索尝试了多个选项。不过,我无法解决此问题。 微服务应用程序.属性 客户端主类 Eureka服务器application.properties 尤里卡服务器主类。

  • 我创建了一个具有“Spring-Cloud-Starter-Netflix-Eureka-Server”依赖项的新Spring Boot项目。还添加了“@enableeurekaserver”注释并启动了spring boot应用程序。 我看到下面的日志消息 上面,我指定了Eureka服务器的位置。但是,为什么客户端无法注册呢? 谢谢!

  • 嗨,当一个新的实例/服务使用Spring cloud API注册到eureka时,我试图调用一个自定义方法。是否有任何处理程序/拦截程序可用于执行此操作?在完成注册后,它应该调用自定义方法,这里我试图将一个事件发布到队列中。

  • 我在Spring cloud文档中读到了用于微服务的Spring Eureka。另外,read Eureka服务器将从注册了Eureks服务器的客户机接收心跳。但是我不明白,为什么我们有这个。客户机以每一个固定的间隔发送心跳,那么healthcheck有什么用?是服务的自定义healthcheck吗?