我在我的大学项目中使用Spring Boot和Hystrix。我遇到的问题是当我将Netflix Hystrix依赖项添加到pom.xml文件并运行程序时,它会抛出一个名为AbstractMethodError的错误:null,但没有Netflix Hystrix依赖项程序运行时没有任何错误。我该如何解决这个问题?
这些是我的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
这是由于依赖性不匹配。应用程序试图调用abstractt方法,但它没有找到该方法。所以,它抛出了null异常。
使用两个依赖关系netflix-hystrix-dashboard和hystrix,如下所示。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>