日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Spring Cloud Netflix—如何加入Hystrix

發布時間:2025/4/16 javascript 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spring Cloud Netflix—如何加入Hystrix 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

要在項目中包含Hystrix,請使用組org.springframework.cloud和artifact id spring-cloud-starter-hystrix的啟動器。有關 使用當前的Spring Cloud發布列表設置構建系統的詳細信息,請參閱Spring Cloud項目頁面。 示例啟動應用程序:

@SpringBootApplication @EnableCircuitBreaker public class Application {

public static void main(String[] args) {new SpringApplicationBuilder(Application.class).web(true).run(args); } 復制代碼

}

@Component public class StoreIntegration {

@HystrixCommand(fallbackMethod = "defaultStores") public Object getStores(Map<String, Object> parameters) {//do stuff that might fail }public Object defaultStores(Map<String, Object> parameters) {return /* something useful */; } 復制代碼

} @HystrixCommand由名為“javanica”的Netflix contrib庫提供 。Spring Cloud在連接到Hystrix斷路器的代理中使用該注釋自動包裝Spring bean。斷路器計算何時打開和關閉電路,以及在發生故障時應該做什么。

要配置@HystrixCommand,您可以使用commandProperties屬性列出@HystrixProperty注釋。請參閱 這里 了解更多詳情。有關 可用屬性的詳細信息,請參閱Hystrix維基。

源碼來源:http://minglisoft.cn/honghu/technology.html

總結

以上是生活随笔為你收集整理的Spring Cloud Netflix—如何加入Hystrix的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。