{"id":435183,"date":"2021-04-18T20:24:29","date_gmt":"2021-04-18T12:24:29","guid":{"rendered":"http:\/\/4563.org\/?p=435183"},"modified":"2021-04-18T20:24:29","modified_gmt":"2021-04-18T12:24:29","slug":"%e8%af%b7%e6%95%99%e4%b8%80%e4%b8%aa%e9%97%ae%e9%a2%98%ef%bc%8c%e5%9c%a8-spring-cloud-gateway-%e7%9a%84-filter-%e4%b8%ad%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8-feign-%e5%90%97","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=435183","title":{"rendered":"\u8bf7\u6559\u4e00\u4e2a\u95ee\u9898\uff0c\u5728 Spring Cloud Gateway \u7684 Filter \u4e2d\u65e0\u6cd5\u4f7f\u7528 Feign \u5417"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u4e00\u4e2a\u95ee\u9898\uff0c\u5728 Spring Cloud Gateway \u7684 Filter \u4e2d\u65e0\u6cd5\u4f7f\u7528 Feign \u5417               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Canon1014 <\/span>  <span><i><\/i> 17<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u51c6\u5907\u7528 gateway \u7684\u8fc7\u6ee4\u5668\u505a\u8eab\u4efd\u9a8c\u8bc1\uff0c\u4f46\u662f FeignClient \u7684 Service \u603b\u662f\u6ce8\u5165\u5931\u8d25\uff08\u62a5\u9519\u4e3a service \u4e3a null \uff09\u3002<\/p>\n<p>\u641c\u5230\u4e86\u4e00\u4e9b\u89e3\u51b3\u65b9\u6cd5\u611f\u89c9\u90fd\u4e0d\u597d\u7528\uff0c\u5f00\u59cb\u6000\u7591\u8fd9\u4e48\u505a\u662f\u4e0d\u662f\u4e0d\u592a\u4f18\u96c5\u3002<\/p>\n<p>\u5728 github \u4e0a\u627e\u5230\u4e86\u7ef4\u62a4\u4eba\u5458\u7684\u56de\u590d\u8bf4 Feign can&#8217;t be used in gateway filters \u3002<\/p>\n<p>\u6c42\u6559\u5404\u4f4d\u6709\u4ec0\u4e48\u529e\u6cd5\u53ef\u4ee5\u89e3\u51b3\u5417\uff0c\u6216\u8005\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5681181\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iminto <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5584\u7528\u641c\u7d22\uff0chttps:\/\/blog.csdn.net\/t18092838767\/article\/details\/109080329                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681182\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Canon1014 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @iminto #1 \u5c1d\u8bd5\u8fc7,\u8fd8\u662f\u6709\u95ee\u9898\u3002\u6211\u73b0\u5728\u6700\u7ea0\u7ed3\u7684\u95ee\u9898\u662f\u65e2\u7136\u8fd9\u4e48\u4e0d\u65b9\u4fbf\u662f\u4e0d\u662f\u8868\u793a\u4e0d\u63d0\u5021\u90a3\u4e48\u505a\uff0c\u6216\u8005\u6709\u66f4\u4f18\u7684\u65b9\u5f0f\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681183\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iminto <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Canon1014 gateway \u4f5c\u4e3a\u7f51\u5173\u5c42\uff0c\u672c\u6765\u5c31\u4e0d\u8be5\u5f04\u5f97\u592a\u590d\u6742\u4e86\uff0c\u5f15\u5165\u5404\u79cd\u4f9d\u8d56\u3002<\/p>\n<p>\u53e6\u5916\uff0cgateway \u662f spring webflux \u67b6\u6784\uff0c\u4e5f\u6709\u5f88\u591a\u9650\u5236\uff0c\u4f20\u7edf\u7684 servlet \u90a3\u5957\u5f88\u591a\u4e1c\u897f\u4e5f\u7528\u4e0d\u4e86\u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681184\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iminto <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8eab\u4efd\u9a8c\u8bc1\uff0c\u6211\u76ee\u524d\u662f\u7528\u7684\u57fa\u4e8e cookie \u6216 jwt \u7684\u65b9\u6848\uff0c\u903b\u8f91\u4e5f\u6ca1\u591a\u590d\u6742\uff0c\u611f\u89c9\u7528\u8d77\u6765\u8fd8\u884c\u3002\u6211\u4e4b\u524d\u8bd5\u8fc7\u5728 gateway \u505a\u8bbf\u95ee\u65e5\u5fd7\uff0c\u540e\u6765\u53d1\u73b0 response \u662f\u5f02\u6b65\u7684\uff0c\u4e0d\u597d\u5904\u7406\uff0c\u5f04\u8d77\u6765\u53c8\u590d\u6742\uff0c\u8fd8\u975e\u5e38\u5f71\u54cd\u6027\u80fd\uff0c\u5c31\u653e\u5f03\u8fd9\u79cd\u601d\u8def\u4e86\u3002\u6240\u4ee5\u5982\u679c\u4f60\u8981\u662f\u89c9\u5f97\u6709\u5565\u4e0d\u987a\u624b\uff0c\u90a3\u5e94\u8be5\u662f\u4f7f\u7528\u59ff\u52bf\u4e0d\u592a\u5bf9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681185\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jzmws <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u54c8\u54c8\u54c8 \u88ab\u5751\u6b7b\u4e86\u628a ! Filter \u521d\u59cb\u5316\u65f6\u5019,bean \u8fd8\u6ca1\u88ab\u6ce8\u5165 !! \u4e0d\u8981\u95ee\u6211\u4e3a\u4ec0\u4e48\u6211\u77e5\u9053\u7684!                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681186\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jzmws <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u624b\u52a8\u7528\u5e26\u53c2\u521d\u59cb\u5316 Filter                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681187\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Canon1014 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @iminto #4 \u611f\u8c22\uff0c\u5728\u770b\u5173\u4e8e spring webflux \u7684\u4e1c\u897f\u4e86\uff0c\u6ca1\u60f3\u5230\u6709\u90a3\u4e48\u591a\u8bb2\u7a76                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5681188\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Canon1014 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @jzmws #5 \u611f\u8c22\uff0c\u5c1d\u8bd5\u4e0b\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u4e00\u4e2a\u95ee\u9898\uff0c\u5728 Spring C&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/435183"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435183"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/435183\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435183"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}