spring-boot - 带有 Hystrix 的 Spring Boot
问题描述
我正在为我的大学项目使用带有 Hystrix 的 Spring Boot。我遇到的问题是,当我将 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>
解决方案
这是由于依赖项不匹配造成的。应用程序正在尝试调用一个抽象方法,但它没有找到该方法。所以,它抛出了空异常。
使用两个依赖 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>
推荐阅读
- hyperlink - 从其他网站链接到表格的特定部分?
- python - Tkinter - 按回车键显示条目内容
- python - 重置后世界崩溃
- javascript - 双击表格行[Material-Table]
- java - 黄瓜 StepDef ResultActions NullPointerException
- vue-router - 直接访问 url 时未解码俄语字符
- java - 如何将 Hibernate orphanRemoval 与 DtoMapping 和 @Audited 一起使用
- ubuntu - Cytoscape 3.7.2 在 Ubuntu 19.10 中不起作用
- c# - Excel 公式附加到 Column 但未呈现值
- python - 保存的model.h5转换为tensorflow文件格式