Spring Boot 2由于Hystrix而无法启动?

Mar*_*mer 7 spring-boot hystrix

我开始研究将Spring Boot应用程序从1.5.x迁移到2。该应用程序依赖于hystrix,但与Spring Boot 2尚不兼容。当我在pom中具有以下内容时:

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-hystrix</artifactId>
  <version>1.4.4.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

启动应用程序时出现以下错误:

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:125)
Run Code Online (Sandbox Code Playgroud)

有人经历过吗?有解决方案吗?

小智 7

I have faced similar issue while integrating hystrix for my spring boot microservice that uses spring boot 2.0.x. Instead of

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
    <version>${spring-hystrix.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

I have moved to

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>${spring-hystrix.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

Spring boot 2.0.x application starts fine with the spring-cloud-starter-netflix-hystrix dependency without this issue.


Mar*_*mer 3

经过进一步研究,我找到了一个解决方案,将以下内容添加到 pom 文件中:

<dependencyManagement>
  <dependencies>
      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-dependencies</artifactId>
          <version>Finchley.RC1</version>
          <type>pom</type>
          <scope>import</scope>
      </dependency>
   </dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

所有版本spring-cloud-dependencies似乎与 Spring Boot 2.xx 不兼容