{"id":9717,"date":"2023-11-28T21:09:38","date_gmt":"2023-11-28T13:09:38","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=9717"},"modified":"2023-12-06T17:34:05","modified_gmt":"2023-12-06T09:34:05","slug":"springcloud-zhong-wang-guan-gateway-he-xin-shi-she","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springcloud-zhong-wang-guan-gateway-he-xin-shi-she\/","title":{"rendered":"SpringCloud\u4e2d\u7f51\u5173\uff08GateWay\uff09\u6838\u5fc3\u662f\u4ec0\u4e48\uff1f"},"content":{"rendered":"<p>\u5728 Spring Cloud \u4e2d\uff0c\u7f51\u5173\uff08Gateway\uff09\u662f\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u7684\u4e00\u4e2a\u5173\u952e\u7ec4\u4ef6\uff0c\u7528\u4e8e\u5904\u7406\u6240\u6709\u5916\u90e8\u8bf7\u6c42\u5e76\u5c06\u5b83\u4eec\u8def\u7531\u5230\u76f8\u5e94\u7684\u5fae\u670d\u52a1\u3002Spring Cloud Gateway \u7684\u6838\u5fc3\u662f\u57fa\u4e8e\u53cd\u5e94\u5f0f\u7f16\u7a0b\u6a21\u578b\u6784\u5efa\u7684\uff0c\u5b83\u4f7f\u7528\u4e86 Spring 5 \u7684 Reactor \u6846\u67b6\u3002\u4ee5\u4e0b\u662f Spring Cloud Gateway \u7684\u6838\u5fc3\u7279\u70b9\u548c\u7ec4\u6210\u90e8\u5206\uff1a<\/p>\n<ol>\n<li>\n<strong>\u53cd\u5e94\u5f0f\u7f16\u7a0b\u6a21\u578b\uff1a<\/strong><\/p>\n<ul>\n<li>Spring Cloud Gateway \u57fa\u4e8e Reactor \u6846\u67b6\uff0c\u91c7\u7528\u4e86\u53cd\u5e94\u5f0f\u7f16\u7a0b\u6a21\u578b\u3002\u8fd9\u610f\u5473\u7740\u5b83\u53ef\u4ee5\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8bf7\u6c42\uff0c\u652f\u6301\u975e\u963b\u585e I\/O \u64cd\u4f5c\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u548c\u8d44\u6e90\u5229\u7528\u7387\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u8def\u7531\u89c4\u5219\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u7684\u6838\u5fc3\u529f\u80fd\u4e4b\u4e00\u662f\u6839\u636e\u8def\u7531\u89c4\u5219\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230\u76f8\u5e94\u7684\u5fae\u670d\u52a1\u3002\u8fd9\u4e9b\u8def\u7531\u89c4\u5219\u5b9a\u4e49\u4e86\u8bf7\u6c42\u5e94\u8be5\u5982\u4f55\u88ab\u5339\u914d\u548c\u8f6c\u53d1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u8fc7\u6ee4\u5668\u94fe\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8fc7\u6ee4\u5668\u673a\u5236\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u901a\u8fc7\u914d\u7f6e\u4e00\u7cfb\u5217\u7684\u8fc7\u6ee4\u5668\u6765\u5728\u8bf7\u6c42\u88ab\u8def\u7531\u4e4b\u524d\u6216\u4e4b\u540e\u6267\u884c\u7279\u5b9a\u7684\u903b\u8f91\u3002\u8fc7\u6ee4\u5668\u53ef\u4ee5\u7528\u4e8e\u5904\u7406\u8ba4\u8bc1\u3001\u9274\u6743\u3001\u65e5\u5fd7\u8bb0\u5f55\u3001\u8bf7\u6c42\u8f6c\u6362\u7b49\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u8def\u7531\u65ad\u8a00\uff08Predicate\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u4f7f\u7528\u8def\u7531\u65ad\u8a00\u6765\u5339\u914d\u8bf7\u6c42\u7684\u5c5e\u6027\uff0c\u4f8b\u5982\u8def\u5f84\u3001\u8bf7\u6c42\u53c2\u6570\u7b49\u3002\u65ad\u8a00\u7528\u4e8e\u786e\u5b9a\u8bf7\u6c42\u662f\u5426\u5339\u914d\u67d0\u4e2a\u8def\u7531\u89c4\u5219\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u7f51\u5173\u8def\u7531\u5b9a\u4e49\uff1a<\/strong><\/p>\n<ul>\n<li>\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u6216\u7f16\u7a0b\u65b9\u5f0f\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u5b9a\u4e49\u7f51\u5173\u7684\u8def\u7531\u89c4\u5219\u3002\u6bcf\u4e2a\u8def\u7531\u89c4\u5219\u7531\u4e00\u4e2a ID\u3001\u4e00\u4e2a\u76ee\u6807 URI\u3001\u4e00\u7ec4\u65ad\u8a00\u548c\u8fc7\u6ee4\u5668\u94fe\u7ec4\u6210\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u52a8\u6001\u8def\u7531\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u652f\u6301\u52a8\u6001\u8def\u7531\uff0c\u8fd9\u610f\u5473\u7740\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u5730\u6dfb\u52a0\u3001\u4fee\u6539\u6216\u5220\u9664\u8def\u7531\u89c4\u5219\uff0c\u800c\u4e0d\u9700\u8981\u505c\u6b62\u7f51\u5173\u670d\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u96c6\u6210\u670d\u52a1\u53d1\u73b0\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u53ef\u4ee5\u96c6\u6210\u670d\u52a1\u6ce8\u518c\u4e2d\u5fc3\uff0c\u901a\u8fc7\u670d\u52a1\u540d\u8fdb\u884c\u8def\u7531\uff0c\u4ee5\u5b9e\u73b0\u5fae\u670d\u52a1\u7684\u52a8\u6001\u53d1\u73b0\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u96c6\u6210\u65ad\u8def\u5668\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u53ef\u4ee5\u96c6\u6210\u65ad\u8def\u5668\u6a21\u5f0f\uff0c\u901a\u8fc7\u4f7f\u7528\u7c7b\u4f3c\u4e8e Netflix Hystrix \u7684\u65ad\u8def\u5668\u6765\u5904\u7406\u6545\u969c\u548c\u670d\u52a1\u964d\u7ea7\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5168\u5c40\u5f02\u5e38\u5904\u7406\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u63d0\u4f9b\u5168\u5c40\u7684\u5f02\u5e38\u5904\u7406\u673a\u5236\uff0c\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u5b9a\u4e49\u5168\u5c40\u6027\u7684\u9519\u8bef\u5904\u7406\u903b\u8f91\uff0c\u4f8b\u5982\u5b9a\u5236\u9519\u8bef\u54cd\u5e94\u6216\u91cd\u5b9a\u5411\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u96c6\u6210 Spring Cloud Security\uff1a<\/strong><\/p>\n<ul>\n<li>Gateway \u53ef\u4ee5\u96c6\u6210 Spring Cloud Security\uff0c\u4ece\u800c\u652f\u6301\u57fa\u4e8e OAuth2 \u7684\u8ba4\u8bc1\u548c\u6388\u6743\u673a\u5236\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u603b\u7684\u6765\u8bf4\uff0cSpring Cloud Gateway \u7684\u6838\u5fc3\u662f\u57fa\u4e8e\u53cd\u5e94\u5f0f\u7f16\u7a0b\u7684\u8def\u7531\u548c\u8fc7\u6ee4\u5668\u673a\u5236\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u800c\u5f3a\u5927\u7684\u914d\u7f6e\u6765\u5b9e\u73b0\u5bf9\u8bf7\u6c42\u7684\u8def\u7531\u548c\u5904\u7406\uff0c\u540c\u65f6\u652f\u6301\u52a8\u6001\u8def\u7531\u548c\u7075\u6d3b\u7684\u8fc7\u6ee4\u5668\u94fe\u3002\u8fd9\u4f7f\u5f97\u5b83\u6210\u4e3a\u6784\u5efa\u9ad8\u6027\u80fd\u3001\u52a8\u6001\u53ef\u6269\u5c55\u7684\u5fae\u670d\u52a1\u7f51\u5173\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Spring Cloud \u4e2d\uff0c\u7f51\u5173\uff08Gateway\uff09\u662f\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u7684\u4e00\u4e2a\u5173\u952e\u7ec4\u4ef6\uff0c\u7528\u4e8e\u5904\u7406\u6240\u6709\u5916\u90e8\u8bf7\u6c42\u5e76\u5c06 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[],"class_list":["post-9717","post","type-post","status-publish","format-standard","hentry","category-springcloud"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/9717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=9717"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/9717\/revisions"}],"predecessor-version":[{"id":16756,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/9717\/revisions\/16756"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=9717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=9717"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=9717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}