提供者pox.xml加入

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


在application启动类中加入注解@EnableHystrix,启动

在@Service类中的每个方法加注解@HystrixCommand

@HystrixCommand(fallbackMethod = "err")

fallbackMethod 表示当前方法熔断了,则跳转到err方法

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐