Sentinel整合Openfeign

Sentinel整合Openfeign

  1. 修改application.yaml
feign:
  sentinel:
    enabled: true
  1. 创建service
@FeignClient(value = "nacos-stock", fallback = StockFallbackService.class)
public class StockService {
}
  1. 创建fallbackservice
@Component
public class StockFallbackService {
}

其他都是参考OpenFeign使用进行配置,主要是yaml配置要打开

你可能感兴趣的:(Spring,Cloud,Alibaba,sentinel,sentinel,java)