{"id":61445,"date":"2026-01-17T16:41:47","date_gmt":"2026-01-17T08:41:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/61445.html"},"modified":"2026-01-17T16:41:47","modified_gmt":"2026-01-17T08:41:47","slug":"%ef%bc%88%e7%ac%ac%e4%b8%83%e7%af%87%ef%bc%89spring-cloud%e4%b9%8bhystrix%e6%96%ad%e8%b7%af%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/61445.html","title":{"rendered":"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:0px\">\u4e00\u3001\u4ecb\u7ecd<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E6%A1%88%E4%BE%8B-toc\" style=\"margin-left:0px\">\u4e8c\u3001\u6848\u4f8b<\/p>\n<p id=\"1%E3%80%81%E6%9E%84%E5%BB%BA8001%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">1\u3001\u6784\u5efa8001\u670d\u52a1<\/p>\n<p id=\"2%E3%80%81%E6%9E%84%E5%BB%BA80%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">2\u3001\u6784\u5efa80\u670d\u52a1<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E6%9C%8D%E5%8A%A1%E9%99%8D%E7%BA%A7-toc\" style=\"margin-left:0px\">\u4e09\u3001\u670d\u52a1\u964d\u7ea7<\/p>\n<p id=\"1%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">1\u3001\u4fee\u65398001\u670d\u52a1<\/p>\n<p id=\"2%E3%80%81%E4%BF%AE%E6%94%B980%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">2\u3001\u4fee\u653980\u670d\u52a1<\/p>\n<p id=\"3%E3%80%81%E4%BC%98%E5%8C%96-toc\" style=\"margin-left:40px\">3\u3001\u4f18\u5316<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E6%9C%8D%E5%8A%A1%E7%86%94%E6%96%AD-toc\" style=\"margin-left:0px\">\u56db\u3001\u670d\u52a1\u7194\u65ad<\/p>\n<p id=\"1%E3%80%81%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:40px\">1\u3001\u4ecb\u7ecd<\/p>\n<p id=\"2%E3%80%81%E7%86%94%E6%96%AD%E7%B1%BB%E5%9E%8B-toc\" style=\"margin-left:40px\">2\u3001\u7194\u65ad\u7c7b\u578b<\/p>\n<p id=\"3%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">3\u3001\u4fee\u65398001\u670d\u52a1<\/p>\n<p id=\"4%E3%80%81%E6%80%BB%E7%BB%93-toc\" style=\"margin-left:40px\">4\u3001\u603b\u7ed3<\/p>\n<p id=\"5%E3%80%81%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E-toc\" style=\"margin-left:40px\">5\u3001\u53c2\u6570\u8bf4\u660e<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E6%9C%8D%E5%8A%A1%E7%9B%91%E6%8E%A7-toc\" style=\"margin-left:0px\">\u4e94\u3001\u670d\u52a1\u76d1\u63a7<\/p>\n<p id=\"1%E3%80%81%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:40px\">1\u3001\u4ecb\u7ecd<\/p>\n<p id=\"2%E3%80%81%E5%88%9B%E5%BB%BA%E7%9B%91%E6%8E%A7%E6%A8%A1%E5%9D%979001-toc\" style=\"margin-left:40px\">2\u3001\u521b\u5efa\u76d1\u63a7\u6a21\u57579001<\/p>\n<p id=\"3%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1-toc\" style=\"margin-left:40px\">3\u3001\u4fee\u65398001\u670d\u52a1<\/p>\n<p id=\"4%E3%80%81%E6%B5%8B%E8%AF%95-toc\" style=\"margin-left:40px\">4\u3001\u6d4b\u8bd5<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"%E4%B8%80%E3%80%81%E4%BB%8B%E7%BB%8D\">\u4e00\u3001\u4ecb\u7ecd<\/h2>\n<p>&#xff08;1&#xff09;\u6982\u8ff0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Hystrix\u662f\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5ef6\u8fdf\u548c\u5bb9\u9519\u7684\u5f00\u6e90\u5e93&#xff0c;\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u91cc&#xff0c;\u8bb8\u591a\u4f9d\u8d56\u4e0d\u53ef\u907f\u514d\u7684\u4f1a\u8c03\u7528\u5931\u8d25&#xff0c;\u6bd4\u5982\u8d85\u65f6\u3001\u5f02\u5e38\u7b49&#xff0c;Hystrix\u80fd\u591f\u4fdd\u8bc1\u5728\u4e00\u4e2a\u4f9d\u8d56\u51fa\u95ee\u9898\u7684\u60c5\u51b5\u4e0b&#xff0c;\u4e0d\u4f1a\u5bfc\u81f4\u6574\u4f53\u670d\u52a1\u5931\u8d25&#xff0c;\u907f\u514d\u7ea7\u8054\u6545\u969c&#xff0c;\u4ee5\u63d0\u9ad8\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5f39\u6027\u3002 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u201c\u65ad\u8def\u5668\u201d\u672c\u8eab\u662f\u4e00\u79cd\u5f00\u5173\u88c5\u7f6e&#xff0c;\u5f53\u67d0\u4e2a\u670d\u52a1\u5355\u5143\u53d1\u751f\u6545\u969c\u4e4b\u540e&#xff0c;\u901a\u8fc7\u65ad\u8def\u5668\u7684\u6545\u969c\u76d1\u63a7&#xff08;\u7c7b\u4f3c\u7194\u65ad\u4fdd\u9669\u4e1d&#xff09;&#xff0c;\u5411\u8c03\u7528\u65b9\u8fd4\u56de\u4e00\u4e2a\u7b26\u5408\u9884\u671f\u7684\u3001\u53ef\u5904\u7406\u7684\u5907\u9009\u54cd\u5e94&#xff08;FallBack&#xff09;&#xff0c;\u800c\u4e0d\u662f\u957f\u65f6\u95f4\u7684\u7b49\u5f85\u6216\u8005\u629b\u51fa\u8c03\u7528\u65b9\u65e0\u6cd5\u5904\u7406\u7684\u5f02\u5e38&#xff0c;\u8fd9\u6837\u5c31\u4fdd\u8bc1\u4e86\u670d\u52a1\u8c03\u7528\u65b9\u7684\u7ebf\u7a0b\u4e0d\u4f1a\u88ab\u957f\u65f6\u95f4\u3001\u4e0d\u5fc5\u8981\u5730\u5360\u7528&#xff0c;\u4ece\u800c\u907f\u514d\u4e86\u6545\u969c\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u8513\u5ef6&#xff0c;\u4e43\u81f3\u96ea\u5d29\u3002<\/p>\n<p>&#xff08;2&#xff09;\u529f\u80fd<\/p>\n<p>\u670d\u52a1\u964d\u7ea7&#xff1a;\u5f53\u670d\u52a1\u7684\u8c03\u7528\u51fa\u73b0\u5f02\u5e38\u6216\u8d85\u65f6&#xff0c;\u7ed9\u51fa\u4e00\u4e2a\u53cb\u597d\u7684\u63d0\u793a&#xff0c;\u5f53\u670d\u52a1\u51fa\u73b0\u7a0b\u5e8f\u8fd0\u884c\u5f02\u5e38\u3001\u8d85\u65f6\u3001\u670d\u52a1\u7194\u65ad\u89e6\u53d1\u670d\u52a1\u964d\u7ea7\u3001\u7ebf\u7a0b\u6c60\/\u4fe1\u53f7\u91cf\u6253\u6ee1\u4e5f\u4f1a\u5bfc\u81f4\u670d\u52a1\u964d\u7ea7\u7b49\u4f1a\u89e6\u53d1\u670d\u52a1\u964d\u7ea7<\/p>\n<p>\u670d\u52a1\u7194\u65ad&#xff1a;\u5f53\u670d\u52a1\u8bbf\u95ee\u91cf\u8fc7\u5927\u65f6&#xff0c;\u76f4\u63a5\u62d2\u7edd\u8bbf\u95ee&#xff0c;\u7136\u540e\u8c03\u7528\u670d\u52a1\u964d\u7ea7\u7684\u65b9\u6cd5\u5e76\u8fd4\u56de\u53cb\u597d\u63d0\u793a\u3002<\/p>\n<p>\u670d\u52a1\u9650\u6d41&#xff1a;\u5f53\u5927\u91cf\u8bf7\u6c42\u8bbf\u95ee\u65f6&#xff0c;\u6392\u961f\u4f9d\u6b21\u5904\u7406&#xff0c;\u6709\u5e8f\u8fdb\u884c\u3002<\/p>\n<p><span class=\"link-card-box\"><span class=\"link-title\">GitHub\u5730\u5740<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084141-696b4b45daed7.png\" \/>https:\/\/github.com\/Netflix\/Hystrix\/wiki\/How-To-Use<\/span><\/span><\/p>\n<h2 id=\"%E4%BA%8C%E3%80%81%E6%A1%88%E4%BE%8B\">\u4e8c\u3001\u6848\u4f8b<\/h2>\n<h3 id=\"1%E3%80%81%E6%9E%84%E5%BB%BA8001%E6%9C%8D%E5%8A%A1\">1\u3001\u6784\u5efa8001\u670d\u52a1<\/h3>\n<p>&#xff08;1&#xff09;\u521b\u5efa\u6a21\u57578001<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cloud-provider-hystrix-payment8001<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"220\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084142-696b4b4605e8d.png\" width=\"407\" \/><\/p>\n<p>&#xff08;2&#xff09;\u6dfb\u52a0pom<\/p>\n<p>&lt;?xml version&#061;&#034;1.0&#034; encoding&#061;&#034;UTF-8&#034;?&gt;<br \/>\n&lt;project xmlns&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0&#034;<br \/>\n         xmlns:xsi&#061;&#034;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#034;<br \/>\n         xsi:schemaLocation&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&#034;&gt;<br \/>\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;<br \/>\n    &lt;parent&gt;<br \/>\n        &lt;groupId&gt;com.hk.cloudstudy&lt;\/groupId&gt;<br \/>\n        &lt;artifactId&gt;SecondSpringCloud&lt;\/artifactId&gt;<br \/>\n        &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br \/>\n    &lt;\/parent&gt;<\/p>\n<p>    &lt;artifactId&gt;cloud-provider-hystrix-payment8001&lt;\/artifactId&gt;<\/p>\n<p>    &lt;properties&gt;<br \/>\n        &lt;maven.compiler.source&gt;8&lt;\/maven.compiler.source&gt;<br \/>\n        &lt;maven.compiler.target&gt;8&lt;\/maven.compiler.target&gt;<br \/>\n        &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;<br \/>\n    &lt;\/properties&gt;<\/p>\n<p>    &lt;dependencies&gt;<br \/>\n        &lt;!&#8211;hystrix&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-netflix-hystrix&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211;eureka client&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-client&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211;web&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<\/p>\n<p>        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<\/p>\n<p>        &lt;dependency&gt;&lt;!&#8211; \u5f15\u5165\u81ea\u5df1\u5b9a\u4e49\u7684api\u901a\u7528\u5305&#xff0c;\u53ef\u4ee5\u4f7f\u7528Payment\u652f\u4ed8Entity &#8211;&gt;<br \/>\n            &lt;groupId&gt;com.hk.cloudstudy&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;cloud-api-commons&lt;\/artifactId&gt;<br \/>\n            &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br \/>\n        &lt;\/dependency&gt;<\/p>\n<p>        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;<br \/>\n            &lt;scope&gt;test&lt;\/scope&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n    &lt;\/dependencies&gt;<\/p>\n<p>&lt;\/project&gt; <\/p>\n<p>&#xff08;3&#xff09;\u6dfb\u52a0yml\u6587\u4ef6<\/p>\n<p>server:<br \/>\n  port: 8001<\/p>\n<p>spring:<br \/>\n  application:<br \/>\n    name: cloud-provider-hystrix-payment<\/p>\n<p>eureka:<br \/>\n  client:<br \/>\n    register-with-eureka: true<br \/>\n    fetch-registry: true<br \/>\n    service-url:<br \/>\n      defaultZone: http:\/\/localhost:7001\/eureka <\/p>\n<p>&#xff08;4&#xff09;\u4fee\u6539\u542f\u52a8\u7c7b<\/p>\n<p>package com.hk.cloudstudy;<\/p>\n<p>import org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<br \/>\nimport org.springframework.cloud.netflix.eureka.EnableEurekaClient;<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableEurekaClient<br \/>\npublic class PaymentHystrixMain8001 {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(PaymentHystrixMain8001.class, args);<br \/>\n    }<br \/>\n} <\/p>\n<p>&#xff08;5&#xff09;\u7f16\u5199service<\/p>\n<p>package com.hk.cloudstudy.service;<\/p>\n<p>import org.springframework.stereotype.Service;<\/p>\n<p>&#064;Service<br \/>\npublic class PaymentServicePaymentService {<\/p>\n<p>    \/\/ \u6b63\u5e38\u5b9e\u4f8b<br \/>\n    public String paymentInfo_OK(Integer id) {<br \/>\n        return &#034;\u7ebf\u7a0b\u6c60&#xff1a;&#034; &#043; Thread.currentThread().getName() &#043; &#034; paymentInfo_OK,id&#xff1a;&#034; &#043; id;<br \/>\n    }<\/p>\n<p>    \/\/ \u8d85\u65f6\u793a\u4f8b<br \/>\n    public String paymentInfo_TimeOut(Integer id) {<br \/>\n        try {<br \/>\n            Thread.sleep(3000);<br \/>\n        } catch (InterruptedException e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n        return &#034;\u7ebf\u7a0b\u6c60&#xff1a;&#034; &#043; Thread.currentThread().getName() &#043; &#034; paymentInfo_TimeOut,id&#xff1a;&#034; &#043; id;<br \/>\n    }<br \/>\n}<\/p>\n<p>&#xff08;6&#xff09;\u7f16\u5199controller<\/p>\n<p>package com.hk.cloudstudy.controller;<\/p>\n<p>import com.hk.cloudstudy.service.PaymentServicePaymentService;<br \/>\nimport lombok.extern.slf4j.Slf4j;<br \/>\nimport org.springframework.beans.factory.annotation.Autowired;<br \/>\nimport org.springframework.beans.factory.annotation.Value;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<br \/>\nimport org.springframework.web.bind.annotation.RestController;<\/p>\n<p>&#064;RestController<br \/>\n&#064;Slf4j<br \/>\npublic class PaymentController {<\/p>\n<p>    &#064;Autowired<br \/>\n    private PaymentServicePaymentService paymentService;<\/p>\n<p>    &#064;Value(&#034;${server.port}&#034;)<br \/>\n    private String serverPort;<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        String res &#061; paymentService.paymentInfo_OK(id);<br \/>\n        log.info(&#034;res &#061; &#034; &#043; res);<br \/>\n        return res;<br \/>\n    }<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    public String paymentInfo_TimeOut(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        String res &#061; paymentService.paymentInfo_TimeOut(id);<br \/>\n        log.info(&#034;res &#061; &#034; &#043; res);<br \/>\n        return res;<br \/>\n    }<br \/>\n}<\/p>\n<p>&#xff08;7&#xff09;\u6d4b\u8bd5<\/p>\n<p>\u542f\u52a87001\u3001\u7136\u540e\u542f\u52a88001<\/p>\n<p>\u8bbf\u95eehttp:\/\/localhost:8001\/payment\/hystrix\/ok\/1\u00a0\u548c\u00a0http:\/\/localhost:8001\/payment\/hystrix\/timeout\/1<\/p>\n<p>\u8fd4\u56de\u7ed3\u679c\u5747\u662f\u6210\u529f\u7684<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"212\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084142-696b4b465fb2f.png\" width=\"664\" \/><\/p>\n<p>\u5f53\u4f7f\u7528\u9ad8\u5e76\u53d1\u5de5\u5177\u6d4b\u8bd5\u63a5\u53e3\u65f6&#xff0c;\u4f1a\u53d1\u73b0\u7a0b\u5e8f\u76f4\u63a5\u88ab\u5361\u6b7b<\/p>\n<h3 id=\"2%E3%80%81%E6%9E%84%E5%BB%BA80%E6%9C%8D%E5%8A%A1\">2\u3001\u6784\u5efa80\u670d\u52a1<\/h3>\n<p>&#xff08;1&#xff09;\u521b\u5efa\u670d\u52a1cloud-consumer-feign-hystrix-order80<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"217\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084142-696b4b46af984.png\" width=\"385\" \/><\/p>\n<p>&#xff08;2&#xff09;\u4fee\u6539pom<\/p>\n<p>&lt;?xml version&#061;&#034;1.0&#034; encoding&#061;&#034;UTF-8&#034;?&gt;<br \/>\n&lt;project xmlns&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0&#034;<br \/>\n         xmlns:xsi&#061;&#034;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#034;<br \/>\n         xsi:schemaLocation&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&#034;&gt;<br \/>\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;<br \/>\n    &lt;parent&gt;<br \/>\n        &lt;groupId&gt;com.hk.cloudstudy&lt;\/groupId&gt;<br \/>\n        &lt;artifactId&gt;SecondSpringCloud&lt;\/artifactId&gt;<br \/>\n        &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br \/>\n    &lt;\/parent&gt;<\/p>\n<p>    &lt;artifactId&gt;cloud-consumer-feign-hystrix-order80&lt;\/artifactId&gt;<\/p>\n<p>    &lt;properties&gt;<br \/>\n        &lt;maven.compiler.source&gt;8&lt;\/maven.compiler.source&gt;<br \/>\n        &lt;maven.compiler.target&gt;8&lt;\/maven.compiler.target&gt;<br \/>\n        &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;<br \/>\n    &lt;\/properties&gt;<\/p>\n<p>    &lt;dependencies&gt;<br \/>\n        &lt;!&#8211;openfeign&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211;hystrix&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-netflix-hystrix&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211;eureka client&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-client&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211; \u5f15\u5165\u81ea\u5df1\u5b9a\u4e49\u7684api\u901a\u7528\u5305&#xff0c;\u53ef\u4ee5\u4f7f\u7528Payment\u652f\u4ed8Entity &#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;com.hk.cloudstudy&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;cloud-api-commons&lt;\/artifactId&gt;<br \/>\n            &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;!&#8211;web&#8211;&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<\/p>\n<p>        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;<br \/>\n            &lt;scope&gt;test&lt;\/scope&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n    &lt;\/dependencies&gt;<br \/>\n&lt;\/project&gt; <\/p>\n<p>&#xff08;3&#xff09;\u6dfb\u52a0yml\u6587\u4ef6<\/p>\n<p>server:<br \/>\n  port: 80<\/p>\n<p>eureka:<br \/>\n  client:<br \/>\n    register-with-eureka: false<br \/>\n    service-url:<br \/>\n      defaultZone: http:\/\/localhost:7001\/eureka\/<\/p>\n<p>&#xff08;4&#xff09;\u4fee\u6539\u542f\u52a8\u7c7b<\/p>\n<p>package com.hk.cloudstudy;<\/p>\n<p>import org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<br \/>\nimport org.springframework.cloud.openfeign.EnableFeignClients;<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableFeignClients<br \/>\npublic class OrderHystrixMain80 {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(OrderHystrixMain80.class, args);<br \/>\n    }<br \/>\n} <\/p>\n<p>&#xff08;5&#xff09;\u7f16\u5199\u8fdc\u7a0b\u8c03\u7528service<\/p>\n<p>package com.hk.cloudstudy.service;<\/p>\n<p>import org.springframework.cloud.openfeign.FeignClient;<br \/>\nimport org.springframework.stereotype.Component;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<\/p>\n<p>&#064;Component<br \/>\n&#064;FeignClient(value &#061; &#034;CLOUD-PROVIDER-HYSTRIX-PAYMENT&#034;)<br \/>\npublic interface PaymentHystrixService {<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id);<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    public String paymentInfo_Timeout(&#064;PathVariable(&#034;id&#034;) Integer id);<br \/>\n}<\/p>\n<p>&#xff08;6&#xff09;\u7f16\u5199controller<\/p>\n<p>package com.hk.cloudstudy.controller;<\/p>\n<p>import com.hk.cloudstudy.service.PaymentHystrixService;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<br \/>\nimport org.springframework.web.bind.annotation.RestController;<\/p>\n<p>import javax.annotation.Resource;<\/p>\n<p>&#064;RestController<br \/>\npublic class OrderHystirxController {<\/p>\n<p>    &#064;Resource<br \/>\n    private PaymentHystrixService paymentHystrixService;<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        return paymentHystrixService.paymentInfo_OK(id);<br \/>\n    }<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    public String paymentInfo_Timeout(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        return paymentHystrixService.paymentInfo_Timeout(id);<br \/>\n    }<br \/>\n}<\/p>\n<p>&#xff08;7&#xff09;\u6d4b\u8bd5<\/p>\n<p>\u5355\u4e00\u6d4b\u8bd5\u65f6\u6210\u529f\u7684&#xff0c;\u5982\u679c\u9ad8\u5e76\u53d1\u6d4b\u8bd5\u4f1a\u51fa\u73b0\u8d85\u65f6\u5f02\u5e38\u3002<\/p>\n<h2 id=\"%E4%B8%89%E3%80%81%E6%9C%8D%E5%8A%A1%E9%99%8D%E7%BA%A7\">\u4e09\u3001\u670d\u52a1\u964d\u7ea7<\/h2>\n<h3 id=\"1%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1\">1\u3001\u4fee\u65398001\u670d\u52a1<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8bbe\u7f6e\u81ea\u8eab\u8c03\u7528\u8d85\u65f6\u65f6\u95f4\u7684\u5cf0\u503c&#xff0c;\u5cf0\u503c\u5185\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c&#xff0c;\u8d85\u8fc7\u4e86\u9700\u8981\u6709\u515c\u5e95\u7684\u65b9\u6cd5\u5904\u7406&#xff0c;\u4f5c\u670d\u52a1\u964d\u7ea7fallback<\/p>\n<p>&#xff08;1&#xff09;\u589e\u52a0fallback<\/p>\n<p>\u4fee\u65398001\u670d\u52a1\u7684service<\/p>\n<p>package com.hk.cloudstudy.service;<\/p>\n<p>import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;<br \/>\nimport org.springframework.stereotype.Service;<\/p>\n<p>&#064;Service<br \/>\npublic class PaymentServicePaymentService {<\/p>\n<p>    \/\/ \u6b63\u5e38\u5b9e\u4f8b<br \/>\n    public String paymentInfo_OK(Integer id) {<br \/>\n        return &#034;\u7ebf\u7a0b\u6c60&#xff1a;&#034; &#043; Thread.currentThread().getName() &#043; &#034; paymentInfo_OK,id&#xff1a;&#034; &#043; id;<br \/>\n    }<\/p>\n<p>    \/\/ \u8d85\u65f6\u793a\u4f8b<br \/>\n    &#064;HystrixCommand(fallbackMethod &#061; &#034;paymentInfo_TimeOutHandler&#034;, commandProperties &#061; {<br \/>\n            &#064;HystrixProperty(name &#061; &#034;execution.isolation.thread.timeoutInMilliseconds&#034;, value &#061; &#034;3000&#034;)<br \/>\n    })<br \/>\n    public String paymentInfo_TimeOut(Integer id) {<br \/>\n        try {<br \/>\n            Thread.sleep(3000);<br \/>\n        } catch (InterruptedException e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n        return &#034;\u7ebf\u7a0b\u6c60&#xff1a;&#034; &#043; Thread.currentThread().getName() &#043; &#034; paymentInfo_TimeOut,id&#xff1a;&#034; &#043; id;<br \/>\n    }<\/p>\n<p>    public String paymentInfo_TimeOutHandler(Integer id) {<br \/>\n        return &#034;\u8c03\u7528\u652f\u4ed8\u63a5\u53e3\u8d85\u65f6\u6216\u5f02\u5e38, \u7ebf\u7a0b\u6c60&#xff1a;&#034; &#043; Thread.currentThread().getName();<br \/>\n    }<br \/>\n}<\/p>\n<p>\u4e00\u65e6\u8c03\u7528\u670d\u52a1\u65b9\u6cd5\u5931\u8d25\u5e76\u629b\u51fa\u4e86\u9519\u8bef\u4fe1\u606f\u540e&#xff0c;\u4f1a\u81ea\u52a8\u8c03\u7528&#064;HystrixCommand\u6807\u6ce8\u597d\u7684fallbackMethod\u8c03\u7528\u7c7b\u4e2d\u7684\u6307\u5b9a\u65b9\u6cd5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"638\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084142-696b4b46db845.png\" width=\"1042\" \/><\/p>\n<p>&#xff08;2&#xff09;\u4fee\u6539\u542f\u52a8\u7c7b<\/p>\n<p>package com.hk.cloudstudy;<\/p>\n<p>import org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<br \/>\nimport org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;<br \/>\nimport org.springframework.cloud.netflix.eureka.EnableEurekaClient;<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableEurekaClient<br \/>\n&#064;EnableCircuitBreaker   \/\/ \u589e\u52a0\u6ce8\u89e3  \u6fc0\u6d3bHystrix<br \/>\npublic class PaymentHystrixMain8001 {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(PaymentHystrixMain8001.class, args);<br \/>\n    }<br \/>\n} <\/p>\n<h3 id=\"2%E3%80%81%E4%BF%AE%E6%94%B980%E6%9C%8D%E5%8A%A1\">2\u3001\u4fee\u653980\u670d\u52a1<\/h3>\n<p>&#xff08;1&#xff09;\u4fee\u6539yml\u6587\u4ef6<\/p>\n<p>server:<br \/>\n  port: 80<\/p>\n<p>eureka:<br \/>\n  client:<br \/>\n    register-with-eureka: false<br \/>\n    service-url:<br \/>\n      defaultZone: http:\/\/localhost:7001\/eureka\/<\/p>\n<p>feign:<br \/>\n  hystrix:<br \/>\n    enabled: true <\/p>\n<p>&#xff08;2&#xff09;\u4fee\u6539\u4e3b\u542f\u52a8\u7c7b<\/p>\n<p>package com.hk.cloudstudy;<\/p>\n<p>import org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<br \/>\nimport org.springframework.cloud.netflix.hystrix.EnableHystrix;<br \/>\nimport org.springframework.cloud.openfeign.EnableFeignClients;<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableFeignClients<br \/>\n&#064;EnableHystrix \/\/ \u5f00\u542fHystrix<br \/>\npublic class OrderHystrixMain80 {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(OrderHystrixMain80.class, args);<br \/>\n    }<br \/>\n} <\/p>\n<p>&#xff08;3&#xff09;controller\u589e\u52a0fallback\u65b9\u6cd5<\/p>\n<p>package com.hk.cloudstudy.controller;<\/p>\n<p>import com.hk.cloudstudy.service.PaymentHystrixService;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<br \/>\nimport org.springframework.web.bind.annotation.RestController;<\/p>\n<p>import javax.annotation.Resource;<\/p>\n<p>&#064;RestController<br \/>\npublic class OrderHystirxController {<\/p>\n<p>    &#064;Resource<br \/>\n    private PaymentHystrixService paymentHystrixService;<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        return paymentHystrixService.paymentInfo_OK(id);<br \/>\n    }<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    &#064;HystrixCommand(fallbackMethod &#061; &#034;paymentTimeOutFallbackMethod&#034;, commandProperties &#061; {<br \/>\n            &#064;HystrixProperty(name &#061; &#034;execution.isolation.thread.timeoutInMilliseconds&#034;, value &#061; &#034;3000&#034;)<br \/>\n    })<br \/>\n    public String paymentInfo_Timeout(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        return paymentHystrixService.paymentInfo_Timeout(id);<br \/>\n    }<\/p>\n<p>    public String paymentTimeOutFallbackMethod(&#064;PathVariable(&#034;id&#034;) Integer id){<br \/>\n        return &#034;80\u6d88\u8d39\u8005&#xff0c;\u5bf9\u65b9\u652f\u4ed8\u7cfb\u7edf\u7e41\u5fd9\u8bf710\u79d2\u949f\u540e\u518d\u8bd5&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"528\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084143-696b4b479eb74.png\" width=\"1036\" \/><\/p>\n<p>&#xff08;4&#xff09;\u6d4b\u8bd5<\/p>\n<p>\u542f\u52a87001\u30018001&#xff1b;\u542f\u52a880<\/p>\n<p>\u9ad8\u5e76\u53d1\u8bbf\u95ee http:\/\/localhost:80\/payment\/hystrix\/timeout\/1<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"279\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b4809782.png\" width=\"719\" \/><\/p>\n<h3 id=\"3%E3%80%81%E4%BC%98%E5%8C%96\">3\u3001\u4f18\u5316<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5982\u679c\u6bcf\u4e2a\u65b9\u6cd5\u90fd\u52a0fallback\u65b9\u6cd5&#xff0c;\u4ee3\u7801\u4f1a\u975e\u5e38\u78b0\u649e&#xff1b;\u800c\u4e14fallback\u65b9\u6cd5\u548c\u4e1a\u52a1\u903b\u8f91\u6df7\u5408\u5728\u4e00\u8d77&#xff0c;\u4f7f\u4ee3\u7801\u663e\u5f97\u5f88\u6df7\u4e71\u3002<\/p>\n<p>&#xff08;1&#xff09;\u4f7f\u7528\u7edf\u4e00\u7684fallback\u65b9\u6cd5<\/p>\n<p>\u4f7f\u7528&#064;DefaultProperties(defaultFallback &#061; &#034;&#034;)\u6ce8\u89e3&#xff0c;\u9664\u4e86\u4e2a\u522b\u91cd\u8981\u6838\u5fc3\u4e1a\u52a1\u6709\u4e13\u5c5e\u7684\u65b9\u6cd5&#xff0c;\u5176\u5b83\u666e\u901a\u7684\u53ef\u4ee5\u901a\u8fc7&#064;DefaultProperties(defaultFallback &#061; &#034;&#034;)\u00a0 \u7edf\u4e00\u5904\u7406\u7ed3\u679c\u9875\u9762&#xff1b;\u901a\u7528\u7684\u548c\u72ec\u4eab\u7684\u5404\u81ea\u5206\u5f00&#xff0c;\u907f\u514d\u4e86\u4ee3\u7801\u81a8\u80c0&#xff1b;\u4fee\u653980\u670d\u52a1\u7684controller\u3002<\/p>\n<p>package com.hk.cloudstudy.controller;<\/p>\n<p>import com.hk.cloudstudy.service.PaymentHystrixService;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;<br \/>\nimport com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<br \/>\nimport org.springframework.web.bind.annotation.RestController;<\/p>\n<p>import javax.annotation.Resource;<\/p>\n<p>&#064;RestController<br \/>\n&#064;DefaultProperties(defaultFallback &#061; &#034;payment_Global_FallbackMethod&#034;)<br \/>\npublic class OrderHystirxController {<\/p>\n<p>    &#064;Resource<br \/>\n    private PaymentHystrixService paymentHystrixService;<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        return paymentHystrixService.paymentInfo_OK(id);<br \/>\n    }<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    \/\/ \u52a0\u4e86&#064;DefaultProperties\u5c5e\u6027\u6ce8\u89e3&#xff0c;\u5e76\u4e14\u6ca1\u6709\u5199\u5177\u4f53\u65b9\u6cd5\u540d\u5b57&#xff0c;\u5c31\u7528\u7edf\u4e00\u5168\u5c40\u7684<br \/>\n    &#064;HystrixCommand<br \/>\n    public String paymentInfo_Timeout(&#064;PathVariable(&#034;id&#034;) Integer id) {<br \/>\n        String msg &#061; paymentHystrixService.paymentInfo_Timeout(id);<br \/>\n        System.out.println(msg);<br \/>\n        return msg;<br \/>\n    }<\/p>\n<p>    public String payment_Global_FallbackMethod(){<br \/>\n        return &#034;80\u6d88\u8d39\u8005&#xff0c;\u5168\u5c40\u5904\u7406&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<p>&#xff08;2&#xff09;\u89e3\u8026\u4e1a\u52a1\u4ee3\u7801\u548cfallback\u65b9\u6cd5<\/p>\n<p>\u7f16\u5199service\u63a5\u53e3\u7684\u5b9e\u73b0<\/p>\n<p>package com.hk.cloudstudy.service;<\/p>\n<p>import org.springframework.stereotype.Component;<\/p>\n<p>&#064;Component<br \/>\npublic class PaymentFallbackService implements PaymentHystrixService {<br \/>\n    &#064;Override<br \/>\n    public String paymentInfo_OK(Integer id) {<br \/>\n        return &#034;paymentInfo_OK \u670d\u52a1\u8c03\u7528\u5931\u8d25&#034;;<br \/>\n    }<\/p>\n<p>    &#064;Override<br \/>\n    public String paymentInfo_Timeout(Integer id) {<br \/>\n        return &#034;paymentInfo_Timeout \u670d\u52a1\u8c03\u7528\u5931\u8d25&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u4fee\u6539service\u63a5\u53e3<\/p>\n<p>package com.hk.cloudstudy.service;<\/p>\n<p>import org.springframework.cloud.openfeign.FeignClient;<br \/>\nimport org.springframework.stereotype.Component;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.PathVariable;<\/p>\n<p>&#064;Component<br \/>\n&#064;FeignClient(value &#061; &#034;CLOUD-PROVIDER-HYSTRIX-PAYMENT&#034;, fallback &#061; PaymentFallbackService.class)<br \/>\npublic interface PaymentHystrixService {<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/ok\/{id}&#034;)<br \/>\n    public String paymentInfo_OK(&#064;PathVariable(&#034;id&#034;) Integer id);<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/hystrix\/timeout\/{id}&#034;)<br \/>\n    public String paymentInfo_Timeout(&#064;PathVariable(&#034;id&#034;) Integer id);<\/p>\n<p>}<\/p>\n<p>\u6d4b\u8bd5&#xff1a;\u5173\u95ed8001\u670d\u52a1&#xff0c;\u518d\u6b21\u8bbf\u95ee http:\/\/localhost:80\/payment\/hystrix\/timeout\/1<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"222\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b482956d.png\" width=\"614\" \/><\/p>\n<h2 id=\"%E5%9B%9B%E3%80%81%E6%9C%8D%E5%8A%A1%E7%86%94%E6%96%AD\">\u56db\u3001\u670d\u52a1\u7194\u65ad<\/h2>\n<h3 id=\"1%E3%80%81%E4%BB%8B%E7%BB%8D\">1\u3001\u4ecb\u7ecd<\/h3>\n<p>\u5f53\u670d\u52a1A\u8c03\u7528\u670d\u52a1B\u7684\u5931\u8d25\u6b21\u6570\u8fbe\u5230\u4e00\u5b9a\u9608\u503c\u65f6&#xff0c;\u6b64\u65f6\u670d\u52a1A\u5c06\u4e0d\u518d\u8c03\u7528\u7684\u670d\u52a1B&#xff0c;\u800c\u662f\u5feb\u901f\u8fd4\u56de\u4e00\u4e2a\u9ed8\u8ba4\u54cd\u5e94&#xff0c;\u5728Spring Cloud\u6846\u67b6\u91cc&#xff0c;\u7194\u65ad\u673a\u5236\u901a\u8fc7Hystrix\u5b9e\u73b0\u3002Hystrix\u4f1a\u76d1\u63a7\u5fae\u670d\u52a1\u95f4\u8c03\u7528\u7684\u72b6\u51b5&#xff0c;\u5f53\u5931\u8d25\u7684\u8c03\u7528\u5230\u4e00\u5b9a\u9608\u503c&#xff0c;\u7f3a\u7701\u662f5\u79d2\u518520\u6b21\u8c03\u7528\u5931\u8d25&#xff0c;\u5c31\u4f1a\u542f\u52a8\u7194\u65ad\u673a\u5236\u3002\u7194\u65ad\u673a\u5236\u7684\u6ce8\u89e3\u662f&#064;HystrixCommand\u3002<\/p>\n<h3 id=\"2%E3%80%81%E7%86%94%E6%96%AD%E7%B1%BB%E5%9E%8B\">2\u3001\u7194\u65ad\u7c7b\u578b<\/h3>\n<ul>\n<li>\u7194\u65ad\u6253\u5f00&#xff1a;\u8bf7\u6c42\u4e0d\u518d\u8fdb\u884c\u8c03\u7528\u5f53\u524d\u670d\u52a1&#xff0c;\u5185\u90e8\u8bbe\u7f6e\u65f6\u949f\u4e00\u822c\u4e3aMTTR&#xff08;\u5e73\u5747\u6545\u969c\u5904\u7406\u65f6\u95f4)&#xff0c;\u5f53\u6253\u5f00\u65f6\u957f\u8fbe\u5230\u6240\u8bbe\u65f6\u949f\u5219\u8fdb\u5165\u534a\u7194\u65ad\u72b6\u6001<\/li>\n<li>\u7194\u65ad\u5173\u95ed&#xff1a;\u7194\u65ad\u5173\u95ed\u4e0d\u4f1a\u5bf9\u670d\u52a1\u8fdb\u884c\u7194\u65ad&#xff0c;\u5f00\u59cb\u8c03\u7528\u4e0b\u6e38\u670d\u52a1<\/li>\n<li>\u7194\u65ad\u534a\u5f00&#xff1a;\u90e8\u5206\u8bf7\u6c42\u6839\u636e\u89c4\u5219\u8c03\u7528\u5f53\u524d\u670d\u52a1&#xff0c;\u5982\u679c\u8bf7\u6c42\u6210\u529f\u4e14\u7b26\u5408\u89c4\u5219\u5219\u8ba4\u4e3a\u5f53\u524d\u670d\u52a1\u6062\u590d\u6b63\u5e38&#xff0c;\u5173\u95ed\u7194\u65ad<\/li>\n<\/ul>\n<h3 id=\"3%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1\">3\u3001\u4fee\u65398001\u670d\u52a1<\/h3>\n<p>&#xff08;1&#xff09;\u4fee\u6539PaymentService<\/p>\n<p>\u589e\u52a0paymentCircuitBreaker\u65b9\u6cd5<\/p>\n<p>    \/\/ \u670d\u52a1\u7194\u65ad<br \/>\n    &#064;HystrixCommand(<br \/>\n            fallbackMethod &#061; &#034;paymentCircuitBreaker_fallback&#034;,<br \/>\n            commandProperties &#061; {<br \/>\n                    &#064;HystrixProperty(name &#061; &#034;circuitBreaker.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n                    &#064;HystrixProperty(name &#061; &#034;circuitBreaker.requestVolumeThreshold&#034;, value &#061; &#034;10&#034;),<br \/>\n                    &#064;HystrixProperty(name &#061; &#034;circuitBreaker.sleepWindowInMilliseconds&#034;, value &#061; &#034;10000&#034;),<br \/>\n                    &#064;HystrixProperty(name &#061; &#034;circuitBreaker.errorThresholdPercentage&#034;, value &#061; &#034;60&#034;)<br \/>\n            }<br \/>\n    )<br \/>\n    public String paymentCircuitBreaker(Integer id) {<br \/>\n        if (id &lt; 0) {<br \/>\n            throw new RuntimeException(&#034;id\u4e0d\u53ef\u4ee5\u5c0f\u4e8e0&#8230;&#034;);<br \/>\n        }<\/p>\n<p>        String n &#061; UUID.fastUUID().toString();<\/p>\n<p>        return &#034;\u6210\u529f&#061;&#061;&#061;&#034; &#043; n;<br \/>\n    }<\/p>\n<p>    public String paymentCircuitBreaker_fallback(Integer id) {<br \/>\n        return &#034;id\u4e0d\u53ef\u4ee5\u5c0f\u4e8e0, \u8bf7\u4f20\u5165\u6b63\u786e\u7684\u6570\u636e&#xff1a; &#034; &#043; id;<br \/>\n    } <\/p>\n<p>\u53c2\u6570\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>enabled&#xff1a;\u5f00\u542f\u65ad\u8def\u5668<\/li>\n<li>requestVolumeThreshold&#xff1a;\u00a0\u8bf7\u6c42\u603b\u6570\u9600\u503c&#xff0c;\u5728\u5feb\u7167\u65f6\u95f4\u7a97\u5185&#xff0c;\u5fc5\u987b\u6ee1\u8db3\u8bf7\u6c42\u603b\u6570\u9600\u503c\u624d\u6709\u8d44\u683c\u7194\u65ad\u3002\u9ed8\u8ba4\u4e3a20&#xff0c;\u610f\u5473\u7740\u572810\u79d2\u5185&#xff0c;\u5982\u679c\u8be5hystrix\u547d\u4ee4\u7684\u8c03\u7528\u6b21\u6570\u4e0d\u8db320\u6b21&#xff0c;\u5373\u4f7f\u6240\u6709\u7684\u8bf7\u6c42\u90fd\u8d85\u65f6\u6216\u5176\u4ed6\u539f\u56e0\u5931\u8d25&#xff0c;\u65ad\u8def\u5668\u90fd\u4e0d\u4f1a\u6253\u5f00\u3002<\/li>\n<li>sleepWindowInMilliseconds&#xff1a;\u65f6\u95f4\u7a97\u53e3<\/li>\n<li>errorThresholdPercentage&#xff1a;\u9519\u8bef\u767e\u5206\u6bd4\u9600\u503c&#xff0c;\u5f53\u8bf7\u6c42\u603b\u6570\u5728\u5feb\u7167\u65f6\u95f4\u7a97\u5185\u8d85\u8fc7\u4e86\u9600\u503c&#xff0c;\u6bd4\u5982\u53d1\u751f\u4e8630\u6b21\u8c03\u7528&#xff0c;\u5982\u679c\u5728\u8fd930\u6b21\u8c03\u7528\u4e2d&#xff0c;\u670915\u6b21\u53d1\u751f\u4e86\u8d85\u65f6\u5f02\u5e38&#xff0c;\u4e5f\u5c31\u662f\u8d85\u8fc750%\u7684\u9519\u8bef\u767e\u5206\u6bd4&#xff0c;\u5728\u9ed8\u8ba4\u8bbe\u5b9a50%\u9600\u503c\u60c5\u51b5\u4e0b&#xff0c;\u8fd9\u65f6\u5019\u5c31\u4f1a\u5c06\u65ad\u8def\u5668\u6253\u5f00\u3002<\/li>\n<\/ul>\n<p>&#xff08;2&#xff09;\u4fee\u6539controller<\/p>\n<p>    &#064;GetMapping(&#034;\/payment\/circuit\/{id}&#034;)<br \/>\n    public String paymentCircuitBreaker(&#064;PathVariable Integer id) {<br \/>\n        return paymentService.paymentCircuitBreaker(id);<br \/>\n    } <\/p>\n<p>&#xff08;3&#xff09;\u6d4b\u8bd5<\/p>\n<p>\u591a\u6b21\u70b9\u51fb\u5931\u8d25&#xff1a;\u4f8b\u598210\u79d2\u51856\u6b21\u5931\u8d25&#xff0c;4\u6b21\u6210\u529f&#xff0c;\u518d\u70b9\u51fb\u4e0b\u4e00\u6b21\u65f6\u4f1a\u89e6\u53d1\u7194\u65ad<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"123\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b485a383.png\" width=\"388\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"134\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b4889da6.png\" width=\"396\" \/><\/p>\n<p>\u7b49\u8fc7\u4e00\u4f1a\u518d\u6b21\u70b9\u51fb\u4f1a\u6210\u529f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"143\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b48bfc9d.png\" width=\"431\" \/><\/p>\n<h3 id=\"4%E3%80%81%E6%80%BB%E7%BB%93\">4\u3001\u603b\u7ed3<\/h3>\n<p>\u65ad\u8def\u5668\u5f00\u542f\u6216\u8005\u5173\u95ed\u7684\u6761\u4ef6&#xff1a;<\/p>\n<ul>\n<li>\u5f53\u6ee1\u8db3\u4e00\u5b9a\u7684\u9600\u503c\u7684\u65f6\u5019&#xff08;\u9ed8\u8ba410\u79d2\u5185\u8d85\u8fc720\u4e2a\u8bf7\u6c42\u6b21\u6570&#xff09;<\/li>\n<li>\u5f53\u5931\u8d25\u7387\u8fbe\u5230\u4e00\u5b9a\u7684\u65f6\u5019&#xff08;\u9ed8\u8ba410\u79d2\u5185\u8d85\u8fc750%\u7684\u8bf7\u6c42\u5931\u8d25&#xff09;<\/li>\n<\/ul>\n<p>\u5230\u8fbe\u4ee5\u4e0a\u9600\u503c&#xff0c;\u65ad\u8def\u5668\u5c06\u4f1a\u5f00\u542f<\/p>\n<p>\u5f53\u5f00\u542f\u7684\u65f6\u5019&#xff0c;\u6240\u6709\u8bf7\u6c42\u90fd\u4e0d\u4f1a\u8fdb\u884c\u8f6c\u53d1&#xff1b;\u4e00\u6bb5\u65f6\u95f4\u4e4b\u540e&#xff08;\u9ed8\u8ba4\u662f5\u79d2&#xff09;&#xff0c;\u8fd9\u4e2a\u65f6\u5019\u65ad\u8def\u5668\u662f\u534a\u5f00\u72b6\u6001&#xff0c;\u4f1a\u8ba9\u5176\u4e2d\u4e00\u4e2a\u8bf7\u6c42\u8fdb\u884c\u8f6c\u53d1\u3002\u5982\u679c\u6210\u529f&#xff0c;\u65ad\u8def\u5668\u4f1a\u5173\u95ed&#xff0c;\u82e5\u5931\u8d25&#xff0c;\u7ee7\u7eed\u5f00\u542f\u3002<\/p>\n<h3 id=\"5%E3%80%81%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E\">5\u3001\u53c2\u6570\u8bf4\u660e<\/h3>\n<p>commandProperties &#061; {<br \/>\n                \/\/ \u8bbe\u7f6e\u9694\u79bb\u7b56\u7565&#xff0c;THREAD \u8868\u793a\u7ebf\u7a0b\u6c60 SEMAPHORE&#xff1a;\u4fe1\u53f7\u6c60\u9694\u79bb<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.isolation.strategy&#034;, value &#061; &#034;THREAD&#034;),<br \/>\n                \/\/ \u5f53\u9694\u79bb\u7b56\u7565\u9009\u62e9\u4fe1\u53f7\u6c60\u9694\u79bb\u7684\u65f6\u5019&#xff0c;\u7528\u6765\u8bbe\u7f6e\u4fe1\u53f7\u6c60\u7684\u5927\u5c0f&#xff08;\u6700\u5927\u5e76\u53d1\u6570&#xff09;<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.isolation.semaphore.maxConcurrentRequests&#034;, value &#061; &#034;10&#034;),<br \/>\n                \/\/ \u914d\u7f6e\u547d\u4ee4\u6267\u884c\u7684\u8d85\u65f6\u65f6\u95f4<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.isolation.thread.timeoutinMilliseconds&#034;, value &#061; &#034;10&#034;),<br \/>\n                \/\/ \u662f\u5426\u542f\u7528\u8d85\u65f6\u65f6\u95f4<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.timeout.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ \u6267\u884c\u8d85\u65f6\u7684\u65f6\u5019\u662f\u5426\u4e2d\u65ad<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.isolation.thread.interruptOnTimeout&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ \u6267\u884c\u88ab\u53d6\u6d88\u7684\u65f6\u5019\u662f\u5426\u4e2d\u65ad<br \/>\n                &#064;HystrixProperty(name &#061; &#034;execution.isolation.thread.interruptOnCancel&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ \u5141\u8bb8\u56de\u8c03\u65b9\u6cd5\u6267\u884c\u7684\u6700\u5927\u5e76\u53d1\u6570<br \/>\n                &#064;HystrixProperty(name &#061; &#034;fallback.isolation.semaphore.maxConcurrentRequests&#034;, value &#061; &#034;10&#034;),<br \/>\n                \/\/ \u670d\u52a1\u964d\u7ea7\u662f\u5426\u542f\u7528&#xff0c;\u662f\u5426\u6267\u884c\u56de\u8c03\u51fd\u6570<br \/>\n                &#064;HystrixProperty(name &#061; &#034;fallback.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ \u662f\u5426\u542f\u7528\u65ad\u8def\u5668<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5728\u6eda\u52a8\u65f6\u95f4\u7a97\u4e2d&#xff0c;\u65ad\u8def\u5668\u7194\u65ad\u7684\u6700\u5c0f\u8bf7\u6c42\u6570\u3002\u4f8b\u5982&#xff0c;\u9ed8\u8ba4\u8be5\u503c\u4e3a 20 \u7684\u65f6\u5019&#xff0c;<br \/>\n                \/\/ \u5982\u679c\u6eda\u52a8\u65f6\u95f4\u7a97&#xff08;\u9ed8\u8ba410\u79d2&#xff09;\u5185\u4ec5\u6536\u5230\u4e8619\u4e2a\u8bf7\u6c42&#xff0c; \u5373\u4f7f\u8fd919\u4e2a\u8bf7\u6c42\u90fd\u5931\u8d25\u4e86&#xff0c;\u65ad\u8def\u5668\u4e5f\u4e0d\u4f1a\u6253\u5f00\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.requestVolumeThreshold&#034;, value &#061; &#034;20&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5728\u6eda\u52a8\u65f6\u95f4\u7a97\u4e2d&#xff0c;\u8868\u793a\u5728\u6eda\u52a8\u65f6\u95f4\u7a97\u4e2d&#xff0c;\u5728\u8bf7\u6c42\u6570\u91cf\u8d85\u8fc7<br \/>\n                \/\/ circuitBreaker.requestVolumeThreshold \u7684\u60c5\u51b5\u4e0b&#xff0c;\u5982\u679c\u9519\u8bef\u8bf7\u6c42\u6570\u7684\u767e\u5206\u6bd4\u8d85\u8fc750,<br \/>\n                \/\/ \u5c31\u628a\u65ad\u8def\u5668\u8bbe\u7f6e\u4e3a &#034;\u6253\u5f00&#034; \u72b6\u6001&#xff0c;\u5426\u5219\u5c31\u8bbe\u7f6e\u4e3a &#034;\u5173\u95ed&#034; \u72b6\u6001\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.errorThresholdPercentage&#034;, value &#061; &#034;50&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5f53\u65ad\u8def\u5668\u6253\u5f00\u4e4b\u540e\u7684\u4f11\u7720\u65f6\u95f4\u7a97\u3002 \u4f11\u7720\u65f6\u95f4\u7a97\u7ed3\u675f\u4e4b\u540e&#xff0c;<br \/>\n                \/\/ \u4f1a\u5c06\u65ad\u8def\u5668\u7f6e\u4e3a &#034;\u534a\u5f00&#034; \u72b6\u6001&#xff0c;\u5c1d\u8bd5\u7194\u65ad\u7684\u8bf7\u6c42\u547d\u4ee4&#xff0c;\u5982\u679c\u4f9d\u7136\u5931\u8d25\u5c31\u5c06\u65ad\u8def\u5668\u7ee7\u7eed\u8bbe\u7f6e\u4e3a &#034;\u6253\u5f00&#034; \u72b6\u6001&#xff0c;<br \/>\n                \/\/ \u5982\u679c\u6210\u529f\u5c31\u8bbe\u7f6e\u4e3a &#034;\u5173\u95ed&#034; \u72b6\u6001\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.sleepWindowinMilliseconds&#034;, value &#061; &#034;5000&#034;),<br \/>\n                \/\/ \u65ad\u8def\u5668\u5f3a\u5236\u6253\u5f00<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.forceOpen&#034;, value &#061; &#034;false&#034;),<br \/>\n                \/\/ \u65ad\u8def\u5668\u5f3a\u5236\u5173\u95ed<br \/>\n                &#064;HystrixProperty(name &#061; &#034;circuitBreaker.forceClosed&#034;, value &#061; &#034;false&#034;),<br \/>\n                \/\/ \u6eda\u52a8\u65f6\u95f4\u7a97\u8bbe\u7f6e&#xff0c;\u8be5\u65f6\u95f4\u7528\u4e8e\u65ad\u8def\u5668\u5224\u65ad\u5065\u5eb7\u5ea6\u65f6\u9700\u8981\u6536\u96c6\u4fe1\u606f\u7684\u6301\u7eed\u65f6\u95f4<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingStats.timeinMilliseconds&#034;, value &#061; &#034;10000&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u6eda\u52a8\u65f6\u95f4\u7a97\u7edf\u8ba1\u6307\u6807\u4fe1\u606f\u65f6\u5212\u5206&#034;\u6876&#034;\u7684\u6570\u91cf&#xff0c;\u65ad\u8def\u5668\u5728\u6536\u96c6\u6307\u6807\u4fe1\u606f\u7684\u65f6\u5019\u4f1a\u6839\u636e<br \/>\n                \/\/ \u8bbe\u7f6e\u7684\u65f6\u95f4\u7a97\u957f\u5ea6\u62c6\u5206\u6210\u591a\u4e2a &#034;\u6876&#034; \u6765\u7d2f\u8ba1\u5404\u5ea6\u91cf\u503c&#xff0c;\u6bcf\u4e2a&#034;\u6876&#034;\u8bb0\u5f55\u4e86\u4e00\u6bb5\u65f6\u95f4\u5185\u7684\u91c7\u96c6\u6307\u6807\u3002<br \/>\n                \/\/ \u6bd4\u5982 10 \u79d2\u5185\u62c6\u5206\u6210 10 \u4e2a&#034;\u6876&#034;\u6536\u96c6\u8fd9\u6837&#xff0c;\u6240\u4ee5 timeinMilliseconds \u5fc5\u987b\u80fd\u88ab numBuckets \u6574\u9664\u3002\u5426\u5219\u4f1a\u629b\u5f02\u5e38<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingStats.numBuckets&#034;, value &#061; &#034;10&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5bf9\u547d\u4ee4\u6267\u884c\u7684\u5ef6\u8fdf\u662f\u5426\u4f7f\u7528\u767e\u5206\u4f4d\u6570\u6765\u8ddf\u8e2a\u548c\u8ba1\u7b97\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a false, \u90a3\u4e48\u6240\u6709\u7684\u6982\u8981\u7edf\u8ba1\u90fd\u5c06\u8fd4\u56de -1\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingPercentile.enabled&#034;, value &#061; &#034;false&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u767e\u5206\u4f4d\u7edf\u8ba1\u7684\u6eda\u52a8\u7a97\u53e3\u7684\u6301\u7eed\u65f6\u95f4&#xff0c;\u5355\u4f4d\u4e3a\u6beb\u79d2\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingPercentile.timeInMilliseconds&#034;, value &#061; &#034;60000&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u767e\u5206\u4f4d\u7edf\u8ba1\u6eda\u52a8\u7a97\u53e3\u4e2d\u4f7f\u7528 \u201c \u6876 \u201d\u7684\u6570\u91cf\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingPercentile.numBuckets&#034;, value &#061; &#034;60000&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\u6bcf\u4e2a \u201c\u6876\u201d \u4e2d\u4fdd\u7559\u7684\u6700\u5927\u6267\u884c\u6b21\u6570\u3002\u5982\u679c\u5728\u6eda\u52a8\u65f6\u95f4\u7a97\u5185\u53d1\u751f\u8d85\u8fc7\u8be5\u8bbe\u5b9a\u503c\u7684\u6267\u884c\u6b21\u6570&#xff0c;<br \/>\n                \/\/ \u5c31\u4ece\u6700\u521d\u7684\u4f4d\u7f6e\u5f00\u59cb\u91cd\u5199\u3002\u4f8b\u5982&#xff0c;\u5c06\u8be5\u503c\u8bbe\u7f6e\u4e3a100, \u6eda\u52a8\u7a97\u53e3\u4e3a10\u79d2&#xff0c;\u82e5\u572810\u79d2\u5185\u4e00\u4e2a \u201c\u6876 \u201d\u4e2d\u53d1\u751f\u4e86500\u6b21\u6267\u884c&#xff0c;<br \/>\n                \/\/ \u90a3\u4e48\u8be5 \u201c\u6876\u201d \u4e2d\u53ea\u4fdd\u7559 \u6700\u540e\u7684100\u6b21\u6267\u884c\u7684\u7edf\u8ba1\u3002\u53e6\u5916&#xff0c;\u589e\u52a0\u8be5\u503c\u7684\u5927\u5c0f\u5c06\u4f1a\u589e\u52a0\u5185\u5b58\u91cf\u7684\u6d88\u8017&#xff0c;\u5e76\u589e\u52a0\u6392\u5e8f\u767e\u5206\u4f4d\u6570\u6240\u9700\u7684\u8ba1\u7b97\u65f6\u95f4\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.rollingPercentile.bucketSize&#034;, value &#061; &#034;100&#034;),<br \/>\n                \/\/ \u8be5\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u91c7\u96c6\u5f71\u54cd\u65ad\u8def\u5668\u72b6\u6001\u7684\u5065\u5eb7\u5feb\u7167&#xff08;\u8bf7\u6c42\u7684\u6210\u529f\u3001 \u9519\u8bef\u767e\u5206\u6bd4&#xff09;\u7684\u95f4\u9694\u7b49\u5f85\u65f6\u95f4\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;metrics.healthSnapshot.intervalinMilliseconds&#034;, value &#061; &#034;500&#034;),<br \/>\n                \/\/ \u662f\u5426\u5f00\u542f\u8bf7\u6c42\u7f13\u5b58<br \/>\n                &#064;HystrixProperty(name &#061; &#034;requestCache.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n                \/\/ HystrixCommand\u7684\u6267\u884c\u548c\u4e8b\u4ef6\u662f\u5426\u6253\u5370\u65e5\u5fd7\u5230 HystrixRequestLog \u4e2d<br \/>\n                &#064;HystrixProperty(name &#061; &#034;requestLog.enabled&#034;, value &#061; &#034;true&#034;),<br \/>\n        },<br \/>\n        threadPoolProperties &#061; {<br \/>\n                \/\/ \u8be5\u53c2\u6570\u7528\u6765\u8bbe\u7f6e\u6267\u884c\u547d\u4ee4\u7ebf\u7a0b\u6c60\u7684\u6838\u5fc3\u7ebf\u7a0b\u6570&#xff0c;\u8be5\u503c\u4e5f\u5c31\u662f\u547d\u4ee4\u6267\u884c\u7684\u6700\u5927\u5e76\u53d1\u91cf<br \/>\n                &#064;HystrixProperty(name &#061; &#034;coreSize&#034;, value &#061; &#034;10&#034;),<br \/>\n                \/\/ \u8be5\u53c2\u6570\u7528\u6765\u8bbe\u7f6e\u7ebf\u7a0b\u6c60\u7684\u6700\u5927\u961f\u5217\u5927\u5c0f\u3002\u5f53\u8bbe\u7f6e\u4e3a -1 \u65f6&#xff0c;\u7ebf\u7a0b\u6c60\u5c06\u4f7f\u7528 SynchronousQueue \u5b9e\u73b0\u7684\u961f\u5217&#xff0c;<br \/>\n                \/\/ \u5426\u5219\u5c06\u4f7f\u7528 LinkedBlockingQueue \u5b9e\u73b0\u7684\u961f\u5217\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;maxQueueSize&#034;, value &#061; &#034;-1&#034;),<br \/>\n                \/\/ \u8be5\u53c2\u6570\u7528\u6765\u4e3a\u961f\u5217\u8bbe\u7f6e\u62d2\u7edd\u9608\u503c\u3002 \u901a\u8fc7\u8be5\u53c2\u6570&#xff0c; \u5373\u4f7f\u961f\u5217\u6ca1\u6709\u8fbe\u5230\u6700\u5927\u503c\u4e5f\u80fd\u62d2\u7edd\u8bf7\u6c42\u3002<br \/>\n                \/\/ \u8be5\u53c2\u6570\u4e3b\u8981\u662f\u5bf9 LinkedBlockingQueue \u961f\u5217\u7684\u8865\u5145,\u56e0\u4e3a LinkedBlockingQueue<br \/>\n                \/\/ \u961f\u5217\u4e0d\u80fd\u52a8\u6001\u4fee\u6539\u5b83\u7684\u5bf9\u8c61\u5927\u5c0f&#xff0c;\u800c\u901a\u8fc7\u8be5\u5c5e\u6027\u5c31\u53ef\u4ee5\u8c03\u6574\u62d2\u7edd\u8bf7\u6c42\u7684\u961f\u5217\u5927\u5c0f\u4e86\u3002<br \/>\n                &#064;HystrixProperty(name &#061; &#034;queueSizeRejectionThreshold&#034;, value &#061; &#034;5&#034;), <\/p>\n<h2 id=\"%E4%BA%94%E3%80%81%E6%9C%8D%E5%8A%A1%E7%9B%91%E6%8E%A7\">\u4e94\u3001\u670d\u52a1\u76d1\u63a7<\/h2>\n<h3 id=\"1%E3%80%81%E4%BB%8B%E7%BB%8D\">1\u3001\u4ecb\u7ecd<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Hystrix\u4f9b\u4e86\u51c6\u5b9e\u65f6\u7684\u8c03\u7528\u76d1\u63a7&#xff08;Hystrix Dashboard&#xff09;&#xff0c;Hystrix\u4f1a\u6301\u7eed\u5730\u8bb0\u5f55\u6240\u6709\u901a\u8fc7Hystrix\u53d1\u8d77\u7684\u8bf7\u6c42\u7684\u6267\u884c\u4fe1\u606f&#xff0c;\u5e76\u4ee5\u7edf\u8ba1\u62a5\u8868\u548c\u56fe\u5f62\u7684\u5f62\u5f0f\u5c55\u793a\u7ed9\u7528\u6237&#xff0c;\u5305\u62ec\u6bcf\u79d2\u6267\u884c\u591a\u5c11\u8bf7\u6c42\u591a\u5c11\u6210\u529f&#xff0c;\u591a\u5c11\u5931\u8d25\u7b49\u3002Netflix\u901a\u8fc7hystrix-metrics-event-stream\u9879\u76ee\u5b9e\u73b0\u4e86\u5bf9\u4ee5\u4e0a\u6307\u6807\u7684\u76d1\u63a7\u3002Spring Cloud\u4e5f\u63d0\u4f9b\u4e86Hystrix Dashboard\u7684\u6574\u5408&#xff0c;\u5bf9\u76d1\u63a7\u5185\u5bb9\u8f6c\u5316\u6210\u53ef\u89c6\u5316\u754c\u9762\u3002<\/p>\n<h3 id=\"2%E3%80%81%E5%88%9B%E5%BB%BA%E7%9B%91%E6%8E%A7%E6%A8%A1%E5%9D%979001\">2\u3001\u521b\u5efa\u76d1\u63a7\u6a21\u57579001<\/h3>\n<p>&#xff08;1&#xff09;\u65b0\u5efa\u6a21\u5757<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"217\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b48e0bcc.png\" width=\"339\" \/><\/p>\n<p>&#xff08;2&#xff09;\u4fee\u6539pom\u6587\u4ef6<\/p>\n<p>&lt;?xml version&#061;&#034;1.0&#034; encoding&#061;&#034;UTF-8&#034;?&gt;<br \/>\n&lt;project xmlns&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0&#034;<br \/>\n         xmlns:xsi&#061;&#034;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#034;<br \/>\n         xsi:schemaLocation&#061;&#034;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&#034;&gt;<br \/>\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;<br \/>\n    &lt;parent&gt;<br \/>\n        &lt;groupId&gt;com.hk.cloudstudy&lt;\/groupId&gt;<br \/>\n        &lt;artifactId&gt;SecondSpringCloud&lt;\/artifactId&gt;<br \/>\n        &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;<br \/>\n    &lt;\/parent&gt;<\/p>\n<p>    &lt;groupId&gt;com.hk&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;cloud-consumer-hystrix-dashboard9001&lt;\/artifactId&gt;<\/p>\n<p>    &lt;properties&gt;<br \/>\n        &lt;maven.compiler.source&gt;8&lt;\/maven.compiler.source&gt;<br \/>\n        &lt;maven.compiler.target&gt;8&lt;\/maven.compiler.target&gt;<br \/>\n        &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;<br \/>\n    &lt;\/properties&gt;<\/p>\n<p>    &lt;dependencies&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-cloud-starter-netflix-hystrix-dashboard&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;<br \/>\n        &lt;\/dependency&gt;<\/p>\n<p>        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-devtools&lt;\/artifactId&gt;<br \/>\n            &lt;scope&gt;runtime&lt;\/scope&gt;<br \/>\n            &lt;optional&gt;true&lt;\/optional&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;lombok&lt;\/artifactId&gt;<br \/>\n            &lt;optional&gt;true&lt;\/optional&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n        &lt;dependency&gt;<br \/>\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n            &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;<br \/>\n            &lt;scope&gt;test&lt;\/scope&gt;<br \/>\n        &lt;\/dependency&gt;<br \/>\n    &lt;\/dependencies&gt;<\/p>\n<p>&lt;\/project&gt; <\/p>\n<p>&#xff08;3&#xff09;\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>server:<br \/>\n    port: 9001 <\/p>\n<p>&#xff08;4&#xff09;\u6dfb\u52a0\u542f\u52a8\u7c7b<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableHystrixDashboard<br \/>\npublic class Main {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(Main.class, args);<br \/>\n    }<br \/>\n} <\/p>\n<h3 id=\"3%E3%80%81%E4%BF%AE%E6%94%B98001%E6%9C%8D%E5%8A%A1\">3\u3001\u4fee\u65398001\u670d\u52a1<\/h3>\n<p>&#xff08;1&#xff09;\u4fee\u6539pom\u6587\u4ef6<\/p>\n<p>\u6dfb\u52a0\u5750\u6807<\/p>\n<p>   &lt;!&#8211; actuator\u76d1\u63a7\u4fe1\u606f\u5b8c\u5584 &#8211;&gt;<br \/>\n&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;<br \/>\n&lt;\/dependency&gt; <\/p>\n<p>&#xff08;2&#xff09;\u4fee\u6539\u542f\u52a8\u7c7b<\/p>\n<p>&#064;SpringBootApplication<br \/>\n&#064;EnableEurekaClient<br \/>\n&#064;EnableCircuitBreaker   \/\/ \u589e\u52a0\u6ce8\u89e3  \u6fc0\u6d3bHystrix<br \/>\npublic class PaymentHystrixMain8001 {<br \/>\n    public static void main(String[] args) {<br \/>\n        SpringApplication.run(PaymentHystrixMain8001.class, args);<br \/>\n    }<\/p>\n<p>    \/**<br \/>\n     *\u6b64\u914d\u7f6e\u662f\u4e3a\u4e86\u670d\u52a1\u76d1\u63a7\u800c\u914d\u7f6e&#xff0c;\u4e0e\u670d\u52a1\u5bb9\u9519\u672c\u8eab\u65e0\u5173&#xff0c;springcloud\u5347\u7ea7\u540e\u7684\u5751<br \/>\n     *ServletRegistrationBean\u56e0\u4e3aspringboot\u7684\u9ed8\u8ba4\u8def\u5f84\u4e0d\u662f&#034;\/hystrix.stream&#034;&#xff0c;<br \/>\n     *\u53ea\u8981\u5728\u81ea\u5df1\u7684\u9879\u76ee\u91cc\u914d\u7f6e\u4e0a\u4e0b\u9762\u7684servlet\u5c31\u53ef\u4ee5\u4e86<br \/>\n     *\/<br \/>\n    &#064;Bean<br \/>\n    public ServletRegistrationBean getServlet() {<br \/>\n        HystrixMetricsStreamServlet streamServlet &#061; new HystrixMetricsStreamServlet();<br \/>\n        ServletRegistrationBean&lt;HystrixMetricsStreamServlet&gt; registrationBean &#061; new ServletRegistrationBean&lt;&gt;(streamServlet);<br \/>\n        registrationBean.setLoadOnStartup(1);<br \/>\n        registrationBean.addUrlMappings(&#034;\/hystrix.stream&#034;);<br \/>\n        registrationBean.setName(&#034;HystrixMetricsStreamServlet&#034;);<br \/>\n        return registrationBean;<br \/>\n    }<br \/>\n } <\/p>\n<h3 id=\"4%E3%80%81%E6%B5%8B%E8%AF%95\" style=\"background-color:transparent\">4\u3001\u6d4b\u8bd5<\/h3>\n<p>&#xff08;1&#xff09;\u586b\u5199\u76d1\u63a7\u5730\u5740<\/p>\n<p>\u8bbf\u95ee&#xff1a;localhost:9001\/hystrix<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"669\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084144-696b4b48f3da3.png\" width=\"1125\" \/><\/p>\n<p>&#xff08;2&#xff09;\u89e6\u53d1\u65ad\u8def<\/p>\n<p>\u8bbf\u95ee&#xff1a;localhost:8001\/payment\/circuit\/10<\/p>\n<p>\u8bbf\u95ee&#xff1a;localhost:8001\/payment\/circuit\/-10<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"409\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084145-696b4b49b1e44.png\" width=\"767\" \/><\/p>\n<p>\u591a\u5931\u8d25\u51e0\u6b21<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"421\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084145-696b4b49d2d62.png\" width=\"662\" \/><\/p>\n<p>&#xff08;3&#xff09;\u56fe\u5f62\u8bf4\u660e<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"486\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084145-696b4b49eb7ad.png\" width=\"907\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"540\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084146-696b4b4a27105.png\" width=\"1353\" \/><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n\u4e00\u3001\u4ecb\u7ecd<br \/>\n\u4e8c\u3001\u6848\u4f8b<br \/>\n1\u3001\u6784\u5efa8001\u670d\u52a1<br \/>\n2\u3001\u6784\u5efa80\u670d\u52a1<br \/>\n\u4e09\u3001\u670d\u52a1\u964d\u7ea7<br \/>\n1\u3001\u4fee\u65398001\u670d\u52a1<br \/>\n2\u3001\u4fee\u653980\u670d\u52a1<br \/>\n3\u3001\u4f18\u5316<br \/>\n\u56db\u3001\u670d\u52a1\u7194\u65ad<br \/>\n1\u3001\u4ecb\u7ecd<br \/>\n2\u3001\u7194\u65ad\u7c7b\u578b<br \/>\n3\u3001\u4fee\u65398001\u670d\u52a1<br \/>\n4\u3001\u603b\u7ed3<br \/>\n5\u3001\u53c2\u6570\u8bf4\u660e<br \/>\n\u4e94\u3001\u670d\u52a1\u76d1\u63a7<br \/>\n1\u3001\u4ecb\u7ecd<br \/>\n2\u3001\u521b\u5efa\u76d1\u63a7\u6a21\u57579001<br \/>\n3\u3001\u4fee\u65398001\u670d\u52a1<br \/>\n4\u3001\u6d4b\u8bd5 \u4e00\u3001\u4ecb\u7ecd<br \/>\n&#xff08;1&#xff09;\u6982\u8ff0 Hystrix\u662f\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5ef6\u8fdf\u548c\u5bb9\u9519\u7684\u5f00\u6e90\u5e93&#xff0c;\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u91cc&amp;#x<\/p>\n","protected":false},"author":2,"featured_media":61428,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[6494,101,963],"topic":[],"class_list":["post-61445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-hystrix","tag-spring","tag-spring-cloud"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/61445.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u4e00\u3001\u4ecb\u7ecd \u4e8c\u3001\u6848\u4f8b 1\u3001\u6784\u5efa8001\u670d\u52a1 2\u3001\u6784\u5efa80\u670d\u52a1 \u4e09\u3001\u670d\u52a1\u964d\u7ea7 1\u3001\u4fee\u65398001\u670d\u52a1 2\u3001\u4fee\u653980\u670d\u52a1 3\u3001\u4f18\u5316 \u56db\u3001\u670d\u52a1\u7194\u65ad 1\u3001\u4ecb\u7ecd 2\u3001\u7194\u65ad\u7c7b\u578b 3\u3001\u4fee\u65398001\u670d\u52a1 4\u3001\u603b\u7ed3 5\u3001\u53c2\u6570\u8bf4\u660e \u4e94\u3001\u670d\u52a1\u76d1\u63a7 1\u3001\u4ecb\u7ecd 2\u3001\u521b\u5efa\u76d1\u63a7\u6a21\u57579001 3\u3001\u4fee\u65398001\u670d\u52a1 4\u3001\u6d4b\u8bd5 \u4e00\u3001\u4ecb\u7ecd &#xff08;1&#xff09;\u6982\u8ff0 Hystrix\u662f\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5ef6\u8fdf\u548c\u5bb9\u9519\u7684\u5f00\u6e90\u5e93&#xff0c;\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u91cc&amp;#x\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/61445.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-17T08:41:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084141-696b4b45daed7.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61445.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/61445.html\",\"name\":\"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-17T08:41:47+00:00\",\"dateModified\":\"2026-01-17T08:41:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/61445.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/61445.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61445.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/61445.html","og_locale":"zh_CN","og_type":"article","og_title":"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u4e00\u3001\u4ecb\u7ecd \u4e8c\u3001\u6848\u4f8b 1\u3001\u6784\u5efa8001\u670d\u52a1 2\u3001\u6784\u5efa80\u670d\u52a1 \u4e09\u3001\u670d\u52a1\u964d\u7ea7 1\u3001\u4fee\u65398001\u670d\u52a1 2\u3001\u4fee\u653980\u670d\u52a1 3\u3001\u4f18\u5316 \u56db\u3001\u670d\u52a1\u7194\u65ad 1\u3001\u4ecb\u7ecd 2\u3001\u7194\u65ad\u7c7b\u578b 3\u3001\u4fee\u65398001\u670d\u52a1 4\u3001\u603b\u7ed3 5\u3001\u53c2\u6570\u8bf4\u660e \u4e94\u3001\u670d\u52a1\u76d1\u63a7 1\u3001\u4ecb\u7ecd 2\u3001\u521b\u5efa\u76d1\u63a7\u6a21\u57579001 3\u3001\u4fee\u65398001\u670d\u52a1 4\u3001\u6d4b\u8bd5 \u4e00\u3001\u4ecb\u7ecd &#xff08;1&#xff09;\u6982\u8ff0 Hystrix\u662f\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5ef6\u8fdf\u548c\u5bb9\u9519\u7684\u5f00\u6e90\u5e93&#xff0c;\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u91cc&amp;#x","og_url":"https:\/\/www.wsisp.com\/helps\/61445.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-17T08:41:47+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260117084141-696b4b45daed7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/61445.html","url":"https:\/\/www.wsisp.com\/helps\/61445.html","name":"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-17T08:41:47+00:00","dateModified":"2026-01-17T08:41:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/61445.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/61445.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/61445.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\uff08\u7b2c\u4e03\u7bc7\uff09spring cloud\u4e4bHystrix\u65ad\u8def\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=61445"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/61428"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=61445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=61445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=61445"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=61445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}