{"id":10008358,"date":"2024-02-17T16:01:16","date_gmt":"2024-02-17T08:01:16","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008358"},"modified":"2024-02-17T16:01:16","modified_gmt":"2024-02-17T08:01:16","slug":"idea-2024-1%ef%bc%9aspring%e6%94%af%e6%8c%81%e5%a2%9e%e5%bc%ba%e3%80%81github-action%e6%94%af%e6%8c%81%e5%a2%9e%e5%bc%ba%e3%80%81%e6%9b%b4%e6%96%b0http-client%e7%ad%89","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008358","title":{"rendered":"IDEA 2024.1\uff1aSpring\u652f\u6301\u589e\u5f3a\u3001GitHub Action\u652f\u6301\u589e\u5f3a\u3001\u66f4\u65b0HTTP Client\u7b49"},"content":{"rendered":"<p>\u6709\u6bb5\u65f6\u95f4\u6ca1\u6709\u66f4\u65b0IDEA\u4e86\uff0c\u65e9\u4e0a\u770b\u5230 IntelliJ IDEA 2024.1 EAP 5\u53d1\u5e03\u7684\u90ae\u4ef6\u63d0\u793a\uff0c\u7784\u4e86\u4e00\u773c\uff0c\u53d1\u73b0\u771f\u7684\u662f\u8d8a\u6765\u8d8a\u5f3a\u4e86\uff0c\u5176\u4e2d\u4e0d\u5c11\u529f\u80fd\u5bf9\u6211\u6765\u8bf4\u8fd8\u662f\u975e\u5e38\u6709\u7528\u7684\u3002\u4e5f\u8bb8\u8fd9\u4e9b\u80fd\u529b\u5bf9\u5173\u6ce8DD\u7684\u5c0f\u4f19\u4f34\u4e5f\u6709\u5e2e\u52a9\uff0c\u6240\u4ee5\u641e\u7bc7\u535a\u5ba2\u4ecb\u7ecd\u548c\u63a8\u8350\u4e00\u4e0b\u3002<\/p>\n<h2>Spring\u3001Quarkus\u7b49\u4e3b\u6d41\u6846\u67b6\u7684\u652f\u6301\u589e\u5f3a<\/h2>\n<ol>\n<li>Search Everywhere\u529f\u80fd\u4e2d\u589e\u52a0<code>Endpoints<\/code>\u9009\u9879\u5361<\/li>\n<\/ol>\n<p>\u5177\u4f53\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNR\" alt=\"\" title=\"\"><\/p>\n<p>\u5f00\u53d1\u8005\u53ef\u4ee5\u5728\u8fd9\u91cc\u76f4\u63a5\u641c\u7d22\u901a\u8fc7Spring\u3001Quarkus\u3001Micronaut\u3001Ktor\u5b9e\u73b0\u7684\u63a5\u53e3\u6765\u627e\u5230\u5177\u4f53\u7684\u4ee3\u7801\u5b9e\u73b0\u4f4d\u7f6e\u3002\u8fd9\u4e2a\u529f\u80fd\u975e\u5e38\u5b9e\u7528\uff0c\u5c24\u5176\u662f\u5bf9\u4e8e\u63a5\u624b\u8001\u9879\u76ee\u7684\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u5b9a\u4f4d\u63a5\u53e3\u5b9e\u73b0\u6765\u5b8c\u6210\u5f00\u53d1\u4efb\u52a1\u6216\u95ee\u9898\u6392\u67e5\u3002<\/p>\n<ol start=\"2\">\n<li>\u589e\u5f3aSpring Bean\u7684\u81ea\u52a8\u8865\u5168\u548c\u81ea\u52a8\u88c5\u914d<\/li>\n<\/ol>\n<p>IntelliJ IDEA \u73b0\u5728\u4e3a\u5e94\u7528\u7a0b\u5e8f\u4e0a\u4e0b\u6587\u4e2d\u7684\u6240\u6709 Bean \u63d0\u4f9b\u81ea\u52a8\u8865\u5168\u529f\u80fd\uff0c\u5e76\u81ea\u52a8\u8fde\u63a5\u5b83\u4eec\u3002<\/p>\n<p>\u5982\u679c bean \u901a\u8fc7\u6784\u9020\u51fd\u6570\u5177\u6709\u81ea\u52a8\u88c5\u914d\u4f9d\u8d56\u9879\uff0c\u5219\u76f8\u5173\u5b57\u6bb5\u4e5f\u4f1a\u901a\u8fc7\u6784\u9020\u51fd\u6570\u81ea\u52a8\u88c5\u914d\u3002<\/p>\n<p>\u540c\u6837\uff0c\u5982\u679c\u901a\u8fc7\u5b57\u6bb5\u6216 Lombok \u7684 <code>@RequiredArgsConstructor<\/code> \u6ce8\u91ca\u6ce8\u5165\u4f9d\u8d56\u9879\uff0c\u5219\u65b0 bean \u4f1a\u81ea\u52a8\u901a\u8fc7\u5b57\u6bb5\u8fde\u63a5\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNS\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<ol start=\"3\">\n<li>\u589e\u5f3a Spring \u6a21\u578b\u56fe<\/li>\n<\/ol>\n<p>\u5728\u8be5\u7248\u672c\u4e2d\u7528\u6237\u8bbf\u95eeSpring\u6a21\u578b\u56fe\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\uff0c\u53ef\u4ee5\u5982\u4e0b\u56fe\u8fd9\u6837\u70b9\u51fbSpring\u6807\u8bc6\u7684\u884c\u6807\u8bb0\u76f4\u63a5\u8df3\u8f6c\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNT\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5feb\u6377\u952e <code>\u2325\u23ce<\/code> (MacOS) \u6216 <code>Alt+Enter<\/code>\uff08Windows\uff09\u6765\u751f\u6210\u548c\u8df3\u8f6c\u3002<\/p>\n<p>\u540c\u65f6\uff0c\u8be5\u7248\u672c\u8fd8\u5f15\u5165\u4e86\u65b0\u7684\u56fe\u6807\uff0c\u589e\u5f3a\u4e86 Spring \u6a21\u578b\u56fe\u7684\u53ef\u89c6\u5316\u5185\u5bb9\uff0c\u5982\uff1a<code>Components<\/code>\u3001<code>Controllers<\/code>\u3001<code>Repositories<\/code>\u3002\u6b64\u5916\uff0c\u60a8\u73b0\u5728\u53ef\u4ee5\u65b9\u4fbf\u5730\u5207\u6362\u5e93\u4e2d Bean \u7684\u53ef\u89c1\u6027\uff08\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u9690\u85cf\u7684\uff09\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNU\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>HTTP Client\u7684\u6539\u8fdb<\/h2>\n<p>HTTP Client\u73b0\u5728\u63d0\u4f9b\u66f4\u591a\u8eab\u4efd\u9a8c\u8bc1\u9009\u9879\uff0c\u5305\u62ec <code>PKCE<\/code> \u6388\u6743\u4ee3\u7801\u548c\u8bbe\u5907\u6388\u4e88\u6d41\u7a0b\u3002\u5b83\u8fd8\u652f\u6301\u4ee4\u724c\u548c\u8eab\u4efd\u9a8c\u8bc1\u8bf7\u6c42\u7684\u989d\u5916\u53c2\u6570\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNV\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u73b0\u5728\u5b83\u53ef\u4ee5\u81ea\u52a8\u5904\u7406 <code>code_challenge<\/code> \u548c <code>passes code_verifier<\/code> \u7684\u751f\u6210\uff0c\u4ee5\u4fbf\u5728 <code>PKCE<\/code> \u8bf7\u6c42\u4e2d\u68c0\u7d22\u4ee4\u724c\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNW\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u4e2a\u7248\u672c\u7684HTTP Client \u53ef\u4ee5\u4f7f\u7528 Netty \u4f5c\u4e3a\u5176\u4f4e\u7ea7\u7f51\u7edc\u5e93\u3002\u901a\u8fc7\u652f\u6301 SSL\u3001\u4ee3\u7406\u548c HTTP\/2\uff0c\u4f7f\u6211\u4eec\u80fd\u591f\u5728 HTTP \u5ba2\u6237\u7aef\u4e2d\u5b9e\u73b0 HTTP\/2 \u7684\u652f\u6301\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNX\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6b64\u5916\uff0cHTTP Client\u7684\u5de5\u5177\u680f\u5916\u89c2\uff0c\u4e5f\u4e0e\u65b0\u7684 UI \u98ce\u683c\u4fdd\u6301\u4e00\u81f4\uff0c\u63d0\u4f9b\u66f4\u52a0\u7f8e\u89c2\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrNY\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>GitHub Action\u7684\u652f\u6301\u589e\u5f3a<\/h2>\n<ol>\n<li>Workflow \u4e0a\u4e0b\u6587\u7684\u652f\u6301<\/li>\n<\/ol>\n<p>\u73b0\u5728\u53ef\u4ee5\u4e3a\u5404\u79cd GitHub Action\u4e0a\u4e0b\u6587\u5f15\u5165\u4e86\u5e7f\u6cdb\u7684\u81ea\u52a8\u5b8c\u6210\u652f\u6301\uff0c\u5305\u62ec<code>github.*<\/code>\u3001<code>env.*<\/code>\u3001<code>steps.*<\/code>\u548c<code>inputs.*<\/code>\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN0\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u4e2a\u4f18\u5316\u975e\u5e38\u6709\u7528\uff0c\u53ef\u4ee5\u6709\u6548\u7684\u964d\u4f4e\u7f16\u5199\u590d\u6742\u5de5\u4f5c\u6d41\u811a\u672c\u7684\u8fc7\u7a0b\uff0c\u5f00\u53d1\u4eba\u5458\u4e0d\u7528\u518d\u53bb\u9891\u7e41\u7684\u641c\u7d22\u4e0a\u4e0b\u6587\u4e2d\u6d89\u53ca\u7684\u53c2\u6570\u4e86\u3002<\/p>\n<p>\u8be5\u4f18\u5316\u5728<code>YAML<\/code>\u6587\u4ef6\u914d\u7f6e\u4e2d\u4e5f\u540c\u6837\u6709\u6548\uff1a<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN1\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728<code>YAML<\/code>\u6587\u4ef6\u4e2d\uff0c\u5f00\u53d1\u8005\u8fd8\u53ef\u4ee5\u4f7f\u7528 <code>branding<\/code> \u529f\u80fd\u4f7f\u7528\u7279\u5b9a\u56fe\u6807\u548c\u989c\u8272\u6307\u793a\u5668\u81ea\u5b9a\u4e49 GitHub \u4e0a\u64cd\u4f5c\u7684\u5916\u89c2\u3002<\/p>\n<p>\u6b64\u529f\u80fd\u4f7f\u64cd\u4f5c\u521b\u5efa\u8005\u80fd\u591f\u5728 GitHub Marketplace \u548c\u5de5\u4f5c\u6d41\u7a0b\u4e2d\u76f4\u89c2\u5730\u533a\u5206\u4ed6\u4eec\u7684\u64cd\u4f5c\uff0c\u4f7f\u5b83\u4eec\u66f4\u6613\u4e8e\u8bc6\u522b\u548c\u7528\u6237\u53cb\u597d\u3002\u901a\u8fc7\u5728 <code>action.yml<\/code> \u6587\u4ef6\u4e2d\u6307\u5b9a\u56fe\u6807\u548c\u989c\u8272\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u4e00\u76ee\u4e86\u7136\u5730\u4f20\u8fbe\u5176\u64cd\u4f5c\u7684\u76ee\u7684\uff0c\u4ece\u800c\u589e\u5f3a\u6574\u4f53\u7528\u6237\u4f53\u9a8c\u3002\u8fd9\u79cd\u53ef\u89c6\u5316\u5b9a\u5236\u6709\u52a9\u4e8e\u5bf9\u64cd\u4f5c\u8fdb\u884c\u5206\u7c7b\uff0c\u5e76\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u8bc6\u522b CI\/CD \u7ba1\u9053\u6240\u9700\u7684\u5de5\u5177\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN2\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<ol start=\"2\">\n<li>Docker \u955c\u50cf\u81ea\u52a8\u8865\u5168<\/li>\n<\/ol>\n<p>\u6b64\u589e\u5f3a\u529f\u80fd\u5728 GitHub \u5de5\u4f5c\u6d41\u7a0b\u6587\u4ef6\u4e2d\u63d0\u4f9bimage\u548ctag\u5efa\u8bae\uff0c\u4ece\u800c\u66f4\u8f7b\u677e\u5730\u5c06 Docker \u5bb9\u5668\u96c6\u6210\u5230\u60a8\u7684\u64cd\u4f5c\u4e2d\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN3\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<ol start=\"3\">\n<li>JavaScript \u6587\u4ef6\u8def\u5f84\u8865\u5168<\/li>\n<\/ol>\n<p>\u6587\u4ef6\u8def\u5f84\u5b8c\u6210\u529f\u80fd\u4f1a\u81ea\u52a8\u5efa\u8bae\u6587\u4ef6\u8def\u5f84\uff0c\u4ece\u800c\u7b80\u5316 JavaScript \u64cd\u4f5c\u7684\u914d\u7f6e\u5e76\u7b80\u5316\u5de5\u4f5c\u6d41\u7a0b\u6267\u884c\u3002<\/p>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN4\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>\u5176\u4ed6\u66f4\u65b0<\/h2>\n<ul>\n<li>\u4f18\u5316JSON schema\u7684\u5904\u7406\uff1a \u4f18\u5316\u4e86 JSON \u6a21\u5f0f\u9a8c\u8bc1\u548c\u5b8c\u6210\u80cc\u540e\u7684\u4ee3\u7801\u3002\u56e0\u6b64\uff0cIDE \u73b0\u5728\u53ef\u4ee5\u66f4\u5feb\u5730\u5904\u7406\u6b64\u4efb\u52a1\u5e76\u51cf\u5c11\u5185\u5b58\u6d88\u8017\u3002\u5728\u4f7f\u7528 Azure Pipelines \u7684\u73b0\u5b9e\u6587\u4ef6\u4e2d\uff0c\u67b6\u6784\u68c0\u67e5\u73b0\u5728\u901f\u5ea6\u63d0\u9ad8\u4e86 10 \u500d\u3002<\/li>\n<li>\u73b0\u5728\u53ef\u4ee5\u5728\u6240\u6709\u5e38\u89c1\u573a\u666f\u4e2d\u8f7b\u677e\u5b8c\u6210 HTTP Header\uff0c\u4f8b\u5982\u4f7f\u7528 Spring WebClient \u548c RestAssured \u6d4b\u8bd5\u3002\u5f53\u9047\u5230\u9884\u671f\u503c\u65f6\uff0c\u4f1a\u81ea\u52a8\u51fa\u73b0\u5b8c\u6210\u5f39\u51fa\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"723\" height=\"292\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdbrN5\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u53e6\u5916\uff0cDD\u6700\u8fd1\u628a\u535a\u5ba2\u91cd\u65b0\u589e\u52a0\u4e86\u677f\u5757\uff0c\u6b63\u5728\u7ef4\u62a4\u51e0\u4e2a\u6709\u610f\u601d\u7684\u957f\u671f\u8fde\u8f7d\u4e13\u680f\uff0c\u5176\u4e2d\u4e00\u4e2a\u5c31\u662f<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=%2BMgeVTrrmwv9XHsOqQMBUA%3D%3D.UgOPoEp9gG0C9YwIGskZ2Ks9LipFis5n3SGq1%2Fmx%2BJ1ti3Lv%2Fhl4CQU9Om25W4wj\" rel=\"noopener noreferrer\">\u300a\u73a9\u8f6cIDEA\u300b<\/a>\uff0c\u8fd9\u6b21\u6362\u4e86\u5de5\u5177\uff0c\u76f4\u63a5\u91c7\u7528\u7535\u5b50\u6587\u6863\u7684\u5f62\u5f0f\uff0c\u9605\u8bfb\u4f53\u9a8c\u66f4\u597d\uff0c\u200b\u5bf9\u8fd9\u4e9b\u5185\u5bb9\u611f\u5174\u8da3\u7684\uff0c\u53ef\u4ee5\u5173\u6ce8\u8d77\u6765\uff01<\/p>\n<blockquote><p>\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u733fDD\u3002\u7b2c\u4e00\u65f6\u95f4\u4e86\u89e3\u524d\u6cbf\u884c\u4e1a\u6d88\u606f\u3001\u5206\u4eab\u6df1\u5ea6\u6280\u672f\u5e72\u8d27\u3001\u83b7\u53d6\u4f18\u8d28\u5b66\u4e60\u8d44\u6e90<\/p><\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044635160\">https:\/\/segmentfault.com\/a\/1190000044635160<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6bb5\u65f6\u95f4\u6ca1\u6709\u66f4\u65b0IDEA\u4e86\uff0c\u65e9\u4e0a\u770b\u5230 IntelliJ IDEA 2024.1 EAP 5\u53d1\u5e03\u7684\u90ae\u4ef6\u63d0\u793a\uff0c\u7784\u4e86 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008358","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008358"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008358\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}