Spring Cloud 中 Hystrix、Ribbon 和 Eureka 的使用与实践
1. 重构设计中的 Feign 客户端交互
在重构设计里,所有 Feign 客户端交互从控制器转移到了组件类。因此, Product Server ***ponent 现在依赖于两个代理,在运行时会使用 Feign 客户端代理进行注入。
2. Hystrix 新设计的编码
2.1 启用 Hystrix 仪表盘
要启用 Hystrix 仪表盘应用程序,需按以下步骤操作:
1. 在 pom.xml 中添加 Hystrix 仪表盘依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
- 在配置类上使用
@