Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot 2 fails starting due to Hystrix?

I started investigating to migrate a Spring Boot application from 1.5.x to 2. This appliication has a dependency to hystrix, which does not be compatible to Spring Boot 2 yet. When I have the following in my pom:

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-hystrix</artifactId>
  <version>1.4.4.RELEASE</version>
</dependency>

I get the following error when starting the application:

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

Anybody has experienced the same? Is there a solution yet?

like image 302
Martin Baeumer Avatar asked May 15 '18 09:05

Martin Baeumer


People also ask

How do I disable hystrix in spring boot?

If you want, you can disable Hystrix as a whole by adding hystrix. enabled = false to your application. properties . This code is actually ready to be put into Spring Boot's autoconfigure module :).

What has replaced Hystrix?

Akka, Envoy, Istio, Zuul, and Polly are the most popular alternatives and competitors to Hystrix.

Is hystrix deprecated?

Spring Cloud Hystrix project is deprecated. So new applications should not use this project. Resilience4j is a new option for Spring developers to implement the circuit breaker pattern.

What is hystrix in spring boot?

Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services, and 3rd party libraries, stop cascading failure, and enable resilience in complex distributed systems where failure is inevitable.


2 Answers

For SpringBoot 2.0 version artifactID has been changed. Old dependency is

     <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-hystrix</artifactId>
          <version>${spring-hystrix.version}</version>
     </dependency>

Use this new updated dependency with latest version

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        <version>2.2.8.RELEASE</version>
    </dependency>

for recent release version you can check MVNrepository

like image 151
anand krish Avatar answered Jan 03 '23 17:01

anand krish


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>

I have moved to

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>${spring-hystrix.version}</version>
</dependency>

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

like image 34
Parthi P Avatar answered Jan 03 '23 18:01

Parthi P