{"id":2943,"date":"2023-07-14T15:34:48","date_gmt":"2023-07-14T07:34:48","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=2943"},"modified":"2023-07-14T15:34:51","modified_gmt":"2023-07-14T07:34:51","slug":"springboot-%e9%80%9a%e7%94%a8%e9%99%90%e6%b5%81%e6%96%b9%e6%a1%88%ef%bc%88vip%e7%8f%8d%e8%97%8f%e7%89%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring\/springboot-%e9%80%9a%e7%94%a8%e9%99%90%e6%b5%81%e6%96%b9%e6%a1%88%ef%bc%88vip%e7%8f%8d%e8%97%8f%e7%89%88%ef%bc%89\/","title":{"rendered":"SpringBoot \u901a\u7528\u9650\u6d41\u65b9\u6848\uff08VIP\u73cd\u85cf\u7248\uff09"},"content":{"rendered":"<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"font-size: 16px;color: black;padding-right: 10px;padding-left: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;\" data-mpa-powered-by=\"yiban.io\">\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u4e00\u3001\u80cc\u666f<\/h1>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u9650\u6d41\u5bf9\u4e8e\u4e00\u4e2a\u5fae\u670d\u52a1\u67b6\u6784\u7cfb\u7edf\u6765\u8bf4\u5177\u6709\u975e\u5e38\u91cd\u8981\u7684\u610f\u4e49\uff0c\u5426\u5219\u5176\u4e2d\u7684\u67d0\u4e2a\u5fae\u670d\u52a1\u5c06\u6210\u4e3a\u6574\u4e2a\u7cfb\u7edf\u9690\u85cf\u7684\u96ea\u5d29\u56e0\u7d20\uff0c\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bf4\uff1f<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e3e\u4f8b\u6765\u8bb2\uff0c\u67d0\u4e2aSAAS\u5e73\u53f0\u6709100\u591a\u4e2a\u5fae\u670d\u52a1\u5e94\u7528\uff0c\u4f46\u662f\u4f5c\u4e3a\u5e95\u5c42\u7684\u67d0\u4e2a\u6216\u67d0\u51e0\u4e2a\u5e94\u7528\u6765\u8bf4\uff0c\u5c06\u4f1a\u88ab\u6240\u6709\u4e0a\u5c42\u5e94\u7528\u9891\u7e41\u8c03\u7528\uff0c\u4e1a\u52a1\u9ad8\u5cf0\u671f\u65f6\uff0c\u5982\u679c\u5e95\u5c42\u5e94\u7528\u4e0d\u505a\u9650\u6d41\u5904\u7406\uff0c\u8be5\u5e94\u7528\u5fc5\u5c06\u9762\u4e34\u7740\u5de8\u5927\u7684\u538b\u529b\uff0c\u5c24\u5176\u662f\u90a3\u4e9b\u4e2a\u522b\u88ab\u9ad8\u9891\u8c03\u7528\u7684\u63a5\u53e3\u6765\u8bf4\uff0c\u6700\u76f4\u63a5\u7684\u8868\u73b0\u5c31\u662f\u5bfc\u81f4\u540e\u7eed\u65b0\u8fdb\u6765\u7684\u8bf7\u6c42\u963b\u585e\u3001\u6392\u961f\u3001\u54cd\u5e94\u8d85\u65f6...\u6700\u540e\u76f4\u5230\u8be5\u670d\u52a1\u6240\u5728JVM\u8d44\u6e90\u88ab\u8017\u5c3d\u3002<\/p>\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u4e8c\u3001\u9650\u6d41\u6982\u8ff0<\/h1>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728\u5927\u591a\u6570\u7684\u5fae\u670d\u52a1\u67b6\u6784\u5728\u8bbe\u8ba1\u4e4b\u521d\uff0c\u6bd4\u5982\u5728\u6280\u672f\u9009\u578b\u9636\u6bb5\uff0c\u67b6\u6784\u5e08\u4f1a\u4ece\u4e00\u4e2a\u5168\u5c40\u7684\u89c6\u89d2\u53bb\u89c4\u5212\u6280\u672f\u6808\u7684\u7ec4\u5408\uff0c\u6bd4\u5982\u7ed3\u5408\u5f53\u524d\u4ea7\u54c1\u7684\u73b0\u72b6\u8003\u8651\u662f\u4f7f\u7528dubbo\uff1f\u8fd8\u662fspringcloud\uff1f\u4f5c\u4e3a\u5fae\u670d\u52a1\u6cbb\u7406\u7684\u5e95\u5c42\u6846\u67b6\u3002\u751a\u81f3\u4e3a\u4e86\u6ee1\u8db3\u5feb\u901f\u7684\u4e0a\u7ebf\u3001\u8fed\u4ee3\u548c\u4ea4\u4ed8\uff0c\u76f4\u63a5\u4ee5springboot\u4e3a\u57fa\u5ea7\u8fdb\u884c\u5f00\u53d1\uff0c\u540e\u7eed\u518d\u5f15\u5165\u65b0\u7684\u6280\u672f\u6808\u7b49...<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u6240\u4ee5\u5728\u8c08\u8bba\u67d0\u4e2a\u4e1a\u52a1\u573a\u666f\u5177\u4f53\u7684\u6280\u672f\u89e3\u51b3\u65b9\u6848\u65f6\u4e0d\u53ef\u4e00\u6982\u800c\u8bba\uff0c\u800c\u662f\u9700\u8981\u7ed3\u5408\u4ea7\u54c1\u548c\u4e1a\u52a1\u7684\u73b0\u72b6\u7efc\u5408\u8bc4\u4f30\uff0c\u4ee5\u9650\u6d41\u6765\u8bf4\uff0c\u5728\u4e0b\u9762\u7684\u4e0d\u540c\u7684\u6280\u672f\u67b6\u6784\u4e0b\u5177\u4f53\u5728\u9009\u62e9\u7684\u65f6\u5019\u53ef\u80fd\u4e5f\u4e0d\u4e00\u6837\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.1 dubbo \u670d\u52a1\u6cbb\u7406\u6a21\u5f0f<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u9009\u62e9dubbo\u6846\u67b6\u4f5c\u4e3a\u57fa\u7840\u670d\u52a1\u6cbb\u7406\u5bf9\u4e8e\u90a3\u79cd\u504f\u5411\u5185\u90e8\u5e73\u53f0\u7684\u5e94\u7528\u8fd8\u662f\u4e0d\u9519\u7684\uff0cdubbo\u5e95\u5c42\u8d70netty\uff0c\u8fd9\u4e00\u70b9\u76f8\u6bd4http\u534f\u8bae\u6765\u8bf4\uff0c\u5728\u4e00\u5b9a\u573a\u666f\u4e0b\u8fd8\u662f\u5177\u6709\u4f18\u52bf\u7684\uff0c\u5982\u679c\u9009\u62e9dubbo\uff0c\u5728\u9009\u62e9\u9650\u6d41\u65b9\u6848\u4e0a\u53ef\u4ee5\u505a\u5982\u4e0b\u7684\u53c2\u8003\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.1.1 dubbo\u6846\u67b6\u7ea7\u9650\u6d41<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">dubbo\u5b98\u65b9\u63d0\u4f9b\u4e86\u5b8c\u5584\u7684\u670d\u52a1\u6cbb\u7406\uff0c\u80fd\u591f\u6ee1\u8db3\u5927\u591a\u6570\u5f00\u53d1\u573a\u666f\u4e2d\u7684\u9700\u6c42\uff0c\u9488\u5bf9\u9650\u6d41\u8fd9\u4e2a\u573a\u666f\uff0c\u5177\u4f53\u6765\u8bf4\u5305\u62ec\u5982\u4e0b\u624b\u6bb5\uff0c\u5177\u4f53\u7684\u914d\u7f6e\uff0c\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u624b\u518c\uff1b<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\"><strong>\u5ba2\u6237\u7aef\u9650\u6d41<\/strong><\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u4fe1\u53f7\u91cf\u9650\u6d41 \uff08\u901a\u8fc7\u7edf\u8ba1\u7684\u65b9\u5f0f\uff09<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u8fde\u63a5\u6570\u9650\u6d41 (socket-&gt;tcp)<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\"><strong>\u670d\u52a1\u7aef\u9650\u6d41<\/strong><\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u7ebf\u7a0b\u6c60\u9650\u6d41 (\u9694\u79bb\u624b\u6bb5)<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u4fe1\u53f7\u91cf\u9650\u6d41 (\u975e\u9694\u79bb\u624b\u6bb5)<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u63a5\u6536\u6570\u9650\u6d41 (socket-&gt;tcp)<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.1.2 \u7ebf\u7a0b\u6c60\u8bbe\u7f6e<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u591a\u7ebf\u7a0b\u5e76\u53d1\u64cd\u4f5c\u4e00\u5b9a\u79bb\u4e0d\u5f00\u7ebf\u7a0b\u6c60\uff0cDubbo\u81ea\u8eab\u63d0\u4f9b\u4e86\u652f\u6301\u4e86\u56db\u79cd\u7ebf\u7a0b\u6c60\u7c7b\u578b\u652f\u6301\u3002\u751f\u4ea7\u8005<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(0, 150, 136);\">&lt;dubbo:protocol&gt;<\/code>\u6807\u7b7e\u4e2d\u53ef\u914d\u7f6e\u7ebf\u7a0b\u6c60\u5173\u952e\u53c2\u6570\uff0c\u7ebf\u7a0b\u6c60\u7c7b\u578b\u3001\u963b\u585e\u961f\u5217\u5927\u5c0f\u3001\u6838\u5fc3\u7ebf\u7a0b\u6570\u91cf\u7b49\uff0c\u901a\u8fc7\u914d\u7f6e\u751f\u4ea7\u7aef\u7684\u7ebf\u7a0b\u6c60\u6570\u91cf\u53ef\u4ee5\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u8d77\u5230\u9650\u6d41\u7684\u6548\u679c\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.1.3 \u96c6\u6210\u7b2c\u4e09\u65b9\u7ec4\u4ef6<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5982\u679c\u662fspringboot\u6846\u67b6\u7684\u9879\u76ee\uff0c\u53ef\u4ee5\u8003\u8651\u76f4\u63a5\u5f15\u5165\u5730\u65b9\u7684\u7ec4\u4ef6\u6216SDK\uff0c\u6bd4\u5982hystrix\uff0cguava\uff0csentinel\u539f\u751fSDK\u7b49\uff0c\u5982\u679c\u6280\u672f\u5b9e\u529b\u8db3\u591f\u5f3a\u751a\u81f3\u53ef\u4ee5\u8003\u8651\u81ea\u5df1\u9020\u8f6e\u5b50\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.2 springcloud \u670d\u52a1\u6cbb\u7406\u6a21\u5f0f<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5982\u679c\u4f60\u7684\u670d\u52a1\u6cbb\u7406\u6846\u67b6\u9009\u7528\u7684\u662fspringcloud\u6216springcloud-alibaba\uff0c\u5176\u6846\u67b6\u81ea\u8eab\u7684\u751f\u6001\u4e2d\u5df2\u7ecf\u5305\u542b\u4e86\u76f8\u5e94\u7684\u9650\u6d41\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5f00\u7bb1\u5373\u7528\uff0c\u4e0b\u9762\u5217\u4e3e\u51e0\u79cd\u5e38\u7528\u7684\u57fa\u4e8espringcloud\u6846\u67b6\u7684\u9650\u6d41\u7ec4\u4ef6\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.2.1 hystrix<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">Hystrix\u662fNetflix\u5f00\u6e90\u7684\u4e00\u6b3e\u5bb9\u9519\u6846\u67b6\uff0c\u5728springcloud\u65e9\u671f\u63a8\u51fa\u5e02\u573a\u7684\u65f6\u5019\uff0c\u4f5c\u4e3aspringcloud\u751f\u6001\u4e2d\u7528\u4e8e\u9650\u6d41\u3001\u7194\u65ad\u3001\u964d\u7ea7\u7684\u4e00\u6b3e\u7ec4\u4ef6\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">Hystrix\u63d0\u4f9b\u4e86\u9650\u6d41\u529f\u80fd\uff0c\u5728springcloud\u67b6\u6784\u7684\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u5728\u7f51\u5173\u542f\u7528Hystrix\uff0c\u8fdb\u884c\u9650\u6d41\u5904\u7406\uff0c\u6bcf\u4e2a\u5fae\u670d\u52a1\u4e5f\u53ef\u4ee5\u5404\u81ea\u542f\u7528Hystrix\u8fdb\u884c\u9650\u6d41\u3002<\/p>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"border-top: none;border-bottom: none;font-size: 0.9em;overflow: auto;background: rgba(0, 0, 0, 0.05);padding: 10px 10px 10px 1em;margin-bottom: 20px;margin-top: 20px;border-left-width: 2px;border-left-color: rgb(136, 136, 136);border-right: 2px solid rgb(136, 136, 136);color: rgb(119, 119, 119);\">\n<p style=\"font-size: 16px;padding-top: 8px;padding-bottom: 8px;text-align: justify;color: black;line-height: 26px;\">Hystrix\u9ed8\u8ba4\u4f7f\u7528\u7ebf\u7a0b\u9694\u79bb\u6a21\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ebf\u7a0b\u6570+\u961f\u5217\u5927\u5c0f\u8fdb\u884c\u9650\u6d41\uff0c\u5177\u4f53\u53c2\u6570\u914d\u7f6e\u53ef\u4ee5\u53c2\u8003\u5b98\u7f51\u76f8\u5173\u8d44\u6599\u3002<\/p>\n<\/blockquote>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.2.2 sentinel<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">Sentinel \u53f7\u79f0\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u6d41\u91cf\u9632\u536b\u5175\uff0c\u5c5e\u4e8espringcloud-alibaba\u751f\u6001\u4e2d\u7684\u91cd\u8981\u7ec4\u4ef6\uff0c\u9762\u5411\u5206\u5e03\u5f0f\u670d\u52a1\u67b6\u6784\u7684\u6d41\u91cf\u63a7\u5236\u7ec4\u4ef6\uff0c\u4e3b\u8981\u4ee5\u6d41\u91cf\u4e3a\u5207\u5165\u70b9\uff0c\u4ece\u9650\u6d41\u3001\u6d41\u91cf\u6574\u5f62\u3001\u7194\u65ad\u964d\u7ea7\u3001\u7cfb\u7edf\u8d1f\u8f7d\u4fdd\u62a4\u3001\u70ed\u70b9\u9632\u62a4\u7b49\u591a\u4e2a\u7ef4\u5ea6\u6765\u5e2e\u52a9\u5f00\u53d1\u8005\u4fdd\u969c\u5fae\u670d\u52a1\u7684\u7a33\u5b9a\u6027\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>2.3 \u7f51\u5173\u5c42\u9650\u6d41<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u968f\u7740\u5fae\u670d\u52a1\u89c4\u6a21\u7684\u589e\u52a0\uff0c\u6574\u4e2a\u7cfb\u7edf\u4e2d\u5f88\u591a\u5fae\u670d\u52a1\u90fd\u9700\u8981\u5b9e\u73b0\u9650\u6d41\u8fd9\u79cd\u9700\u6c42\u65f6\uff0c\u5c31\u53ef\u4ee5\u8003\u8651\u5728\u7f51\u5173\u8fd9\u4e00\u5c42\u8fdb\u884c\u9650\u6d41\u4e86\uff0c\u901a\u5e38\u6765\u8bf4\uff0c\u7f51\u5173\u5c42\u7684\u9650\u6d41\u9762\u5411\u7684\u662f\u901a\u7528\u7684\u4e1a\u52a1\uff0c\u6bd4\u5982\u90a3\u4e9b\u6076\u610f\u7684\u8bf7\u6c42\uff0c\u722c\u866b\uff0c\u653b\u51fb\u7b49\uff0c\u7b80\u5355\u6765\u8bf4\uff0c\u7f51\u5173\u5c42\u9762\u7684\u9650\u6d41\u63d0\u4f9b\u4e86\u4e00\u5c42\u5bf9\u7cfb\u7edf\u6574\u4f53\u7684\u4fdd\u62a4\u63aa\u65bd\u3002<\/p>\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u4e09\u3001\u5e38\u7528\u9650\u6d41\u7b56\u7565<\/h1>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>3.1 \u9650\u6d41\u5e38\u7528\u7684\u7b97\u6cd5<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e0d\u7ba1\u662f\u54ea\u79cd\u9650\u6d41\u7ec4\u4ef6\uff0c\u5176\u5e95\u5c42\u7684\u9650\u6d41\u5b9e\u73b0\u7b97\u6cd5\u5927\u540c\u5c0f\u5f02\uff0c\u8fd9\u91cc\u5217\u4e3e\u51e0\u79cd\u5e38\u7528\u7684\u9650\u6d41\u7b97\u6cd5\u4ee5\u4f9b\u4e86\u89e3\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>3.1.1 \u4ee4\u724c\u6876\u7b97\u6cd5<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4ee4\u724c\u6876\u7b97\u6cd5\u662f\u76ee\u524d\u5e94\u7528\u6700\u4e3a\u5e7f\u6cdb\u7684\u9650\u6d41\u7b97\u6cd5\uff0c\u987e\u540d\u601d\u4e49\uff0c\u5b83\u6709\u4ee5\u4e0b\u4e24\u4e2a\u5173\u952e\u89d2\u8272\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u4ee4\u724c \uff1a\u83b7\u53d6\u5230\u4ee4\u724c\u7684Request\u624d\u4f1a\u88ab\u5904\u7406\uff0c\u5176\u4ed6Requests\u8981\u4e48\u6392\u961f\u8981\u4e48\u88ab\u76f4\u63a5\u4e22\u5f03\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u6876 \uff1a\u7528\u6765\u88c5\u4ee4\u724c\u7684\u5730\u65b9\uff0c\u6240\u6709Request\u90fd\u4ece\u8fd9\u4e2a\u6876\u91cc\u9762\u83b7\u53d6\u4ee4\u724c<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.4574314574314574\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.4574314574314574\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4ee4\u724c\u6876\u4e3b\u8981\u6d89\u53ca\u52302\u4e2a\u8fc7\u7a0b\uff0c\u5373\u4ee4\u724c\u7684\u751f\u6210\uff0c\u4ee4\u724c\u7684\u83b7\u53d6<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>3.1.2 \u6f0f\u6876\u7b97\u6cd5<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u6f0f\u6876\u7b97\u6cd5\u7684\u524d\u534a\u6bb5\u548c\u4ee4\u724c\u6876\u7c7b\u4f3c\uff0c\u4f46\u662f\u64cd\u4f5c\u7684\u5bf9\u8c61\u4e0d\u540c\uff0c\u7ed3\u5408\u4e0b\u56fe\u8fdb\u884c\u7406\u89e3\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4ee4\u724c\u6876\u662f\u5c06\u4ee4\u724c\u653e\u5165\u6876\u91cc\uff0c\u800c\u6f0f\u6876\u662f\u5c06\u8bbf\u95ee\u8bf7\u6c42\u7684\u6570\u636e\u5305\u653e\u5230\u6876\u91cc\u3002\u540c\u6837\u7684\u662f\uff0c\u5982\u679c\u6876\u6ee1\u4e86\uff0c\u90a3\u4e48\u540e\u9762\u65b0\u6765\u7684\u6570\u636e\u5305\u5c06\u88ab\u4e22\u5f03\u3002<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.5974025974025974\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404dbdbf1dcf.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.5974025974025974\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404dbdbf1dcf.png\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>3.1.3 \u6ed1\u52a8\u65f6\u95f4\u7a97\u53e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u6839\u636e\u4e0b\u56fe\uff0c\u7b80\u5355\u63cf\u8ff0\u4e0b\u6ed1\u52a8\u65f6\u95f4\u7a97\u53e3\u8fd9\u79cd\u8fc7\u7a0b\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: black;text-align: justify;\">\u9ed1\u8272\u5927\u6846\u4e3a\u65f6\u95f4\u7a97\u53e3\uff0c\u53ef\u4ee5\u8bbe\u5b9a\u7a97\u53e3\u65f6\u95f4\u5355\u4f4d\u4e3a5\u79d2\uff0c\u5b83\u4f1a\u968f\u7740\u65f6\u95f4\u63a8\u79fb\u5411\u540e\u6ed1\u52a8\u3002\u6211\u4eec\u5c06\u7a97\u53e3\u5185\u7684\u65f6\u95f4\u5212\u5206\u4e3a\u4e94\u4e2a\u5c0f\u683c\u5b50\uff0c\u6bcf\u4e2a\u683c\u5b50\u4ee3\u88681\u79d2\u949f\uff0c\u540c\u65f6\u8fd9\u4e2a\u683c\u5b50\u8fd8\u5305\u542b\u4e00\u4e2a\u8ba1\u6570\u5668\uff0c\u7528\u6765\u8ba1\u7b97\u5728\u5f53\u524d\u65f6\u95f4\u5185\u8bbf\u95ee\u7684\u8bf7\u6c42\u6570\u91cf\u3002\u90a3\u4e48\u8fd9\u4e2a\u65f6\u95f4\u7a97\u53e3\u5185\u7684\u603b\u8bbf\u95ee\u91cf\u5c31\u662f\u6240\u6709\u683c\u5b50\u8ba1\u6570\u5668\u7d2f\u52a0\u540e\u7684\u6570\u503c\uff1b<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: black;text-align: justify;\">\u6bd4\u5982\u8bf4\uff0c\u6211\u4eec\u5728\u6bcf\u4e00\u79d2\u5185\u67095\u4e2a\u7528\u6237\u8bbf\u95ee\uff0c\u7b2c5\u79d2\u5185\u670910\u4e2a\u7528\u6237\u8bbf\u95ee\uff0c\u90a3\u4e48\u57280\u52305\u79d2\u8fd9\u4e2a\u65f6\u95f4\u7a97\u53e3\u5185\u8bbf\u95ee\u91cf\u5c31\u662f15\u3002\u5982\u679c\u6211\u4eec\u7684\u63a5\u53e3\u8bbe\u7f6e\u4e86\u65f6\u95f4\u7a97\u53e3\u5185\u8bbf\u95ee\u4e0a\u9650\u662f20\uff0c\u90a3\u4e48\u5f53\u65f6\u95f4\u5230\u7b2c\u516d\u79d2\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u65f6\u95f4\u7a97\u53e3\u5185\u7684\u8ba1\u6570\u603b\u548c\u5c31\u53d8\u6210\u4e8610\uff0c\u56e0\u4e3a1\u79d2\u7684\u683c\u5b50\u5df2\u7ecf\u9000\u51fa\u4e86\u65f6\u95f4\u7a97\u53e3\uff0c\u56e0\u6b64\u5728\u7b2c\u516d\u79d2\u5185\u53ef\u4ee5\u63a5\u6536\u7684\u8bbf\u95ee\u91cf\u5c31\u662f20-10=10\u4e2a\uff1b<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.3203463203463203\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/2023071415340445451598e.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.3203463203463203\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/2023071415340445451598e.png\" png\"=\"\" data-w=\"693\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u6ed1\u52a8\u7a97\u53e3\u5176\u5b9e\u4e5f\u662f\u4e00\u79cd\u8ba1\u7b97\u5668\u7b97\u6cd5\uff0c\u5b83\u6709\u4e00\u4e2a\u663e\u8457\u7279\u70b9\uff0c\u5f53\u65f6\u95f4\u7a97\u53e3\u7684\u8de8\u5ea6\u8d8a\u957f\u65f6\uff0c\u9650\u6d41\u6548\u679c\u5c31\u8d8a\u5e73\u6ed1\u3002\u6253\u4e2a\u6bd4\u65b9\uff0c\u5982\u679c\u5f53\u524d\u65f6\u95f4\u7a97\u53e3\u53ea\u6709\u4e24\u79d2\uff0c\u800c\u8bbf\u95ee\u8bf7\u6c42\u5168\u90e8\u96c6\u4e2d\u5728\u7b2c\u4e00\u79d2\u7684\u65f6\u5019\uff0c\u5f53\u65f6\u95f4\u5411\u540e\u6ed1\u52a8\u4e00\u79d2\u540e\uff0c\u5f53\u524d\u7a97\u53e3\u7684\u8ba1\u6570\u91cf\u5c06\u53d1\u751f\u8f83\u5927\u7684\u53d8\u5316\uff0c\u62c9\u957f\u65f6\u95f4\u7a97\u53e3\u53ef\u4ee5\u964d\u4f4e\u8fd9\u79cd\u60c5\u51b5\u7684\u53d1\u751f\u6982\u7387<\/p>\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u56db\u3001\u901a\u7528\u9650\u6d41\u5b9e\u73b0\u65b9\u6848<\/h1>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u629b\u5f00\u7f51\u5173\u5c42\u7684\u9650\u6d41\u5148\u4e0d\u8bf4\uff0c\u5728\u5fae\u670d\u52a1\u5e94\u7528\u4e2d\uff0c\u8003\u8651\u5230\u6280\u672f\u6808\u7684\u7ec4\u5408\uff0c\u56e2\u961f\u4eba\u5458\u7684\u5f00\u53d1\u6c34\u5e73\uff0c\u4ee5\u53ca\u6613\u7ef4\u62a4\u6027\u7b49\u56e0\u7d20\uff0c\u4e00\u4e2a\u6bd4\u8f83\u901a\u7528\u7684\u505a\u6cd5\u662f\uff0c\u5229\u7528AOP\u6280\u672f+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u5b9e\u73b0\u5bf9\u7279\u5b9a\u7684\u65b9\u6cd5\u6216\u63a5\u53e3\u8fdb\u884c\u9650\u6d41\uff0c\u4e0b\u9762\u57fa\u4e8e\u8fd9\u4e2a\u601d\u8def\u6765\u5206\u522b\u4ecb\u7ecd\u4e0b\u51e0\u79cd\u5e38\u7528\u7684\u9650\u6d41\u65b9\u6848\u7684\u5b9e\u73b0\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.1 \u57fa\u4e8eguava\u9650\u6d41\u5b9e\u73b0<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">guava\u4e3a\u8c37\u6b4c\u5f00\u6e90\u7684\u4e00\u4e2a\u6bd4\u8f83\u5b9e\u7528\u7684\u7ec4\u4ef6\uff0c\u5229\u7528\u8fd9\u4e2a\u7ec4\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u5b8c\u6210\u5e38\u89c4\u7684\u9650\u6d41\u64cd\u4f5c\uff0c\u63a5\u4e0b\u6765\u770b\u5177\u4f53\u7684\u5b9e\u73b0\u6b65\u9aa4\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.1.1 \u5f15\u5165guava\u4f9d\u8d56<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u7248\u672c\u53ef\u4ee5\u9009\u62e9\u66f4\u9ad8\u7684\u6216\u5176\u4ed6\u7248\u672c<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.google.guava<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>guava<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>23.0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.1.2 \u81ea\u5b9a\u4e49\u9650\u6d41\u6ce8\u89e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u81ea\u5b9a\u4e49\u4e00\u4e2a\u9650\u6d41\u7528\u7684\u6ce8\u89e3\uff0c\u540e\u9762\u5728\u9700\u8981\u9650\u6d41\u7684\u65b9\u6cd5\u6216\u63a5\u53e3\u4e0a\u9762\u53ea\u9700\u6dfb\u52a0\u8be5\u6ce8\u89e3\u5373\u53ef\uff1b<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.ElementType;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.Retention;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.RetentionPolicy;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.Target;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>(value&nbsp;=&nbsp;ElementType.METHOD)\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(value&nbsp;=&nbsp;RetentionPolicy.RUNTIME)\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;RateConfigAnno&nbsp;{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limitType<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">double<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limitCount<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;5d<\/span>;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.1.3 \u9650\u6d41AOP\u7c7b<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u901a\u8fc7AOP\u524d\u7f6e\u901a\u77e5\u7684\u65b9\u5f0f\u62e6\u622a\u6dfb\u52a0\u4e86\u4e0a\u8ff0\u81ea\u5b9a\u4e49\u9650\u6d41\u6ce8\u89e3\u7684\u65b9\u6cd5\uff0c\u89e3\u6790\u6ce8\u89e3\u4e2d\u7684\u5c5e\u6027\u503c\uff0c\u5e76\u4ee5\u8be5\u5c5e\u6027\u503c\u4f5c\u4e3aguava\u63d0\u4f9b\u7684\u9650\u6d41\u53c2\u6570\uff0c\u8be5\u7c7b\u4e3a\u6574\u4e2a\u5b9e\u73b0\u7684\u6838\u5fc3\u6240\u5728\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.fastjson2.JSONObject;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.google.common.util.concurrent.RateLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.JoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Before;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.Logger;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.LoggerFactory;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.RequestContextHolder;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.ServletRequestAttributes;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.servlet.ServletOutputStream;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.servlet.http.HttpServletResponse;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.io.IOException;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Objects;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">GuavaLimitAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;Logger&nbsp;logger&nbsp;=&nbsp;LoggerFactory.getLogger(GuavaLimitAop<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Before<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"execution(@RateConfigAnno&nbsp;*&nbsp;*(..))\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limit<\/span><span style=\"line-height: 26px;\">(JoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/1\u3001\u83b7\u53d6\u5f53\u524d\u7684\u8c03\u7528\u65b9\u6cd5<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;currentMethod&nbsp;=&nbsp;getCurrentMethod(joinPoint);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(Objects.isNull(currentMethod))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/2\u3001\u4ece\u65b9\u6cd5\u6ce8\u89e3\u5b9a\u4e49\u4e0a\u83b7\u53d6\u9650\u6d41\u7684\u7c7b\u578b<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;limitType&nbsp;=&nbsp;currentMethod.getAnnotation(RateConfigAnno<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">limitType<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">double<\/span>&nbsp;limitCount&nbsp;=&nbsp;currentMethod.getAnnotation(RateConfigAnno<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">limitCount<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u4f7f\u7528guava\u7684\u4ee4\u724c\u6876\u7b97\u6cd5\u83b7\u53d6\u4e00\u4e2a\u4ee4\u724c\uff0c\u83b7\u53d6\u4e0d\u5230\u5148\u7b49\u5f85<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RateLimiter&nbsp;rateLimiter&nbsp;=&nbsp;RateLimitHelper.getRateLimiter(limitType,&nbsp;limitCount);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">boolean<\/span>&nbsp;b&nbsp;=&nbsp;rateLimiter.tryAcquire();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(b)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style=\"color: #98c379;line-height: 26px;\">\"\u83b7\u53d6\u5230\u4ee4\u724c\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpServletResponse&nbsp;resp&nbsp;=&nbsp;((ServletRequestAttributes)&nbsp;RequestContextHolder.getRequestAttributes()).getResponse();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JSONObject&nbsp;jsonObject=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;JSONObject();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonObject.put(<span style=\"color: #98c379;line-height: 26px;\">\"success\"<\/span>,<span style=\"color: #c678dd;line-height: 26px;\">false<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonObject.put(<span style=\"color: #98c379;line-height: 26px;\">\"msg\"<\/span>,<span style=\"color: #98c379;line-height: 26px;\">\"\u9650\u6d41\u4e2d\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output(resp,&nbsp;jsonObject.toJSONString());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.error(<span style=\"color: #98c379;line-height: 26px;\">\"error,e:{}\"<\/span>,e);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;Method&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getCurrentMethod<\/span><span style=\"line-height: 26px;\">(JoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method[]&nbsp;methods&nbsp;=&nbsp;joinPoint.getTarget().getClass().getMethods();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;target&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>&nbsp;(Method&nbsp;method&nbsp;:&nbsp;methods)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(method.getName().equals(joinPoint.getSignature().getName()))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;=&nbsp;method;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">break<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;target;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">output<\/span><span style=\"line-height: 26px;\">(HttpServletResponse&nbsp;response,&nbsp;String&nbsp;msg)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;IOException&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.setContentType(<span style=\"color: #98c379;line-height: 26px;\">\"application\/json;charset=UTF-8\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ServletOutputStream&nbsp;outputStream&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream&nbsp;=&nbsp;response.getOutputStream();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.write(msg.getBytes(<span style=\"color: #98c379;line-height: 26px;\">\"UTF-8\"<\/span>));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(IOException&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">finally<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.flush();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.close();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5176\u4e2d\u9650\u6d41\u7684\u6838\u5fc3API\u5373\u4e3aRateLimiter\u8fd9\u4e2a\u5bf9\u8c61\uff0c\u6d89\u53ca\u5230\u7684RateLimitHelper\u7c7b\u5982\u4e0b<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.google.common.util.concurrent.RateLimiter;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.HashMap;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Map;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">RateLimitHelper<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">RateLimitHelper<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;Map&lt;String,RateLimiter&gt;&nbsp;rateMap&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;HashMap&lt;&gt;();\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;RateLimiter&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getRateLimiter<\/span><span style=\"line-height: 26px;\">(String&nbsp;limitType,<span style=\"color: #c678dd;line-height: 26px;\">double<\/span>&nbsp;limitCount&nbsp;)<\/span><\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RateLimiter&nbsp;rateLimiter&nbsp;=&nbsp;rateMap.get(limitType);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>(rateLimiter&nbsp;==&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimiter&nbsp;=&nbsp;RateLimiter.create(limitCount);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateMap.put(limitType,rateLimiter);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;rateLimiter;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.1.4 \u6d4b\u8bd5\u63a5\u53e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e0b\u9762\u6dfb\u52a0\u4e00\u4e2a\u6d4b\u8bd5\u63a5\u53e3\uff0c\u6d4b\u8bd5\u4e00\u4e0b\u4e0a\u9762\u7684\u4ee3\u7801\u662f\u5426\u751f\u6548<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@RestController<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">OrderController<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/localhost:8081\/save<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"\/save\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@RateConfigAnno<\/span>(limitType&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"saveOrder\"<\/span>,limitCount&nbsp;=&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">save<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"success\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728\u63a5\u53e3\u4e2d\u4e3a\u4e86\u6a21\u62df\u51fa\u6548\u679c\uff0c\u6211\u4eec\u5c06\u53c2\u6570\u8bbe\u7f6e\u7684\u975e\u5e38\u5c0f\uff0c\u5373QPS\u4e3a1\uff0c\u53ef\u4ee5\u9884\u60f3\u5f53\u6bcf\u79d2\u8bf7\u6c42\u8d85\u8fc71\u65f6\u5c06\u4f1a\u51fa\u73b0\u88ab\u9650\u6d41\u7684\u63d0\u793a\uff0c\u542f\u52a8\u5de5\u7a0b\u5e76\u9a8c\u8bc1\u63a5\u53e3\uff0c\u6bcf\u79d21\u6b21\u7684\u8bf7\u6c42\uff0c\u53ef\u4ee5\u6b63\u5e38\u5f97\u5230\u7ed3\u679c\uff0c\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.32456140350877194\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404bdbd2d9ea.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"456\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.32456140350877194\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404bdbd2d9ea.png\" png\"=\"\" data-w=\"456\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5feb\u901f\u5237\u63a5\u53e3\uff0c\u5c06\u4f1a\u770b\u5230\u4e0b\u9762\u7684\u6548\u679c<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.3073852295409182\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405575771e9b.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"501\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.3073852295409182\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405575771e9b.png\" png\"=\"\" data-w=\"501\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.2 \u57fa\u4e8esentinel\u9650\u6d41\u5b9e\u73b0<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728\u4e0d\u5c11\u540c\u5b66\u7684\u610f\u8bc6\u4e2d\uff0csentinel\u901a\u5e38\u662f\u9700\u8981\u7ed3\u5408springcloud-alibaba\u6846\u67b6\u4e00\u8d77\u5b9e\u7528\u7684\uff0c\u800c\u4e14\u4e0e\u6846\u67b6\u96c6\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u914d\u5408\u63a7\u5236\u53f0\u4e00\u8d77\u4f7f\u7528\u8fbe\u5230\u66f4\u597d\u7684\u6548\u679c\uff0c\u5b9e\u9645\u4e0a\uff0csentinel\u5b98\u65b9\u4e5f\u63d0\u4f9b\u4e86\u76f8\u5bf9\u539f\u751f\u7684SDK\u53ef\u4f9b\u4f7f\u7528\uff0c\u63a5\u4e0b\u6765\u5c31\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u8fdb\u884c\u6574\u5408\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.2.1 \u5f15\u5165sentinel\u6838\u5fc3\u4f9d\u8d56\u5305<span style=\"display: none;\"><\/span><\/h3>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.alibaba.csp<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>sentinel-core<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>1.8.0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.2.2 \u81ea\u5b9a\u4e49\u9650\u6d41\u6ce8\u89e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u53ef\u4ee5\u6839\u636e\u9700\u8981\uff0c\u6dfb\u52a0\u66f4\u591a\u7684\u5c5e\u6027<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.ElementType;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.Retention;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.RetentionPolicy;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.annotation.Target;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>(value&nbsp;=&nbsp;ElementType.METHOD)\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(value&nbsp;=&nbsp;RetentionPolicy.RUNTIME)\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;SentinelLimitAnnotation&nbsp;{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">resourceName<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limitCount<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;5<\/span>;\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.2.3 \u81ea\u5b9a\u4e49AOP\u7c7b\u5b9e\u73b0\u9650\u6d41<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u8be5\u7c7b\u7684\u5b9e\u73b0\u601d\u8def\u4e0e\u4e0a\u8ff0\u4f7f\u7528guava\u7c7b\u4f3c\uff0c\u4e0d\u540c\u7684\u662f\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684\u662fsentinel\u539f\u751f\u7684\u9650\u6d41\u76f8\u5173\u7684API\uff0c\u5bf9\u6b64\u4e0d\u591f\u5c5e\u6027\u7684\u53ef\u4ee5\u67e5\u9605\u5b98\u65b9\u7684\u6587\u6863\u8fdb\u884c\u5b66\u4e60\uff0c\u8fd9\u91cc\u5c31\u4e0d\u5c55\u5f00\u6765\u8bf4\u4e86\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.Entry;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.SphU;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.Tracer;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.BlockException;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.RuleConstant;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.flow.FlowRule;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.apache.commons.lang3.StringUtils;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.JoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.ProceedingJoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Around;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Pointcut;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.ArrayList;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.List;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Objects;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">SentinelMethodLimitAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">initFlowRule<\/span><span style=\"line-height: 26px;\">(String&nbsp;resourceName,<span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;limitCount)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;FlowRule&gt;&nbsp;rules&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ArrayList&lt;&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FlowRule&nbsp;rule&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;FlowRule();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u53d7\u4fdd\u62a4\u7684\u8d44\u6e90<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setResource(resourceName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u6d41\u63a7\u89c4\u5219&nbsp;QPS<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setGrade(RuleConstant.FLOW_GRADE_QPS);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u53d7\u4fdd\u62a4\u7684\u8d44\u6e90\u9608\u503c<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setCount(limitCount);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rules.add(rule);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u52a0\u8f7d\u914d\u7f6e\u597d\u7684\u89c4\u5219<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FlowRuleManager.loadRules(rules);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Pointcut<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.congge.sentinel.SentinelLimitAnnotation)\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">rateLimit<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"rateLimit()\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">around<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/1\u3001\u83b7\u53d6\u5f53\u524d\u7684\u8c03\u7528\u65b9\u6cd5<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;currentMethod&nbsp;=&nbsp;getCurrentMethod(joinPoint);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(Objects.isNull(currentMethod))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/2\u3001\u4ece\u65b9\u6cd5\u6ce8\u89e3\u5b9a\u4e49\u4e0a\u83b7\u53d6\u9650\u6d41\u7684\u7c7b\u578b<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;resourceName&nbsp;=&nbsp;currentMethod.getAnnotation(SentinelLimitAnnotation<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">resourceName<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>(StringUtils.isEmpty(resourceName)){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throw<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;RuntimeException(<span style=\"color: #98c379;line-height: 26px;\">\"\u8d44\u6e90\u540d\u79f0\u4e3a\u7a7a\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;limitCount&nbsp;=&nbsp;currentMethod.getAnnotation(SentinelLimitAnnotation<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">limitCount<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initFlowRule(resourceName,limitCount);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Entry&nbsp;entry&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;result&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entry&nbsp;=&nbsp;SphU.entry(resourceName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;joinPoint.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Throwable&nbsp;throwable)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throwable.printStackTrace();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(BlockException&nbsp;ex)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u8d44\u6e90\u8bbf\u95ee\u963b\u6b62\uff0c\u88ab\u9650\u6d41\u6216\u88ab\u964d\u7ea7<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5728\u6b64\u5904\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u64cd\u4f5c<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style=\"color: #98c379;line-height: 26px;\">\"blocked\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u88ab\u9650\u6d41\u4e86\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tracer.traceEntry(e,&nbsp;entry);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">finally<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(entry&nbsp;!=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entry.exit();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;result;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;Method&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getCurrentMethod<\/span><span style=\"line-height: 26px;\">(JoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method[]&nbsp;methods&nbsp;=&nbsp;joinPoint.getTarget().getClass().getMethods();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;target&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>&nbsp;(Method&nbsp;method&nbsp;:&nbsp;methods)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(method.getName().equals(joinPoint.getSignature().getName()))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;=&nbsp;method;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">break<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;target;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.2.4 \u81ea\u5b9a\u4e49\u6d4b\u8bd5\u63a5\u53e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e3a\u4e86\u6a21\u62df\u6548\u679c\uff0c\u8fd9\u91cc\u5c06QPS\u7684\u6570\u91cf\u8bbe\u7f6e\u4e3a1<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/localhost:8081\/limit<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"\/limit\"<\/span>)\n<span style=\"color: #61aeee;line-height: 26px;\">@SentinelLimitAnnotation<\/span>(limitCount&nbsp;=&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>,resourceName&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"sentinelLimit\"<\/span>)\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">sentinelLimit<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"sentinelLimit\"<\/span>;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u542f\u52a8\u5de5\u7a0b\u4e4b\u540e\uff0c\u6d4f\u89c8\u5668\u8c03\u7528\u63a5\u53e3\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u6bcf\u79d2\u4e00\u4e2a\u8bf7\u6c42\uff0c\u53ef\u4ee5\u6b63\u5e38\u901a\u8fc7<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.23991507430997877\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405b1b13e264.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"471\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.23991507430997877\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405b1b13e264.png\" png\"=\"\" data-w=\"471\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5feb\u901f\u5237\u63a5\u53e3\uff0c\u8d85\u8fc7\u6bcf\u79d21\u6b21\u65f6\uff0c\u6548\u679c\u5982\u4e0b<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.24759615384615385\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405c9c99635f.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"416\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.24759615384615385\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405c9c99635f.png\" png\"=\"\" data-w=\"416\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u8fd9\u91cc\u53ea\u662f\u4e3a\u4e86\u6f14\u793a\u51fa\u6548\u679c\uff0c\u5efa\u8bae\u5728\u771f\u5b9e\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u65f6\uff0c\u5bf9\u8fd4\u56de\u7ed3\u679c\u505a\u4e00\u4e2a\u5c01\u88c5\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3 \u57fa\u4e8eredis+lua\u9650\u6d41\u5b9e\u73b0<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">redis\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u5929\u7136\u5177\u6709\u7ebf\u7a0b\u5b89\u5168\u7684\u7279\u6027\uff0c\u652f\u6301\u539f\u5b50\u6027\u64cd\u4f5c\uff0c\u9650\u6d41\u670d\u52a1\u4e0d\u4ec5\u9700\u8981\u627f\u63a5\u8d85\u9ad8QPS\uff0c\u8fd8\u8981\u4fdd\u8bc1\u9650\u6d41\u903b\u8f91\u7684\u6267\u884c\u5c42\u9762\u5177\u5907\u7ebf\u7a0b\u5b89\u5168\u7684\u7279\u6027\uff0c\u5229\u7528Redis\u8fd9\u4e9b\u7279\u6027\u505a\u9650\u6d41\uff0c\u65e2\u80fd\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168\uff0c\u4e5f\u80fd\u4fdd\u8bc1\u6027\u80fd\u3002\u57fa\u4e8eredis\u7684\u9650\u6d41\u5b9e\u73b0\u5b8c\u6574\u6d41\u7a0b\u5982\u4e0b\u56fe\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.5838323353293413\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/202307141534066e6ebf82a.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"1002\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.5838323353293413\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/202307141534066e6ebf82a.png\" png\"=\"\" data-w=\"1002\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u7ed3\u5408\u4e0a\u9762\u7684\u6d41\u7a0b\u56fe\uff0c\u8fd9\u91cc\u68b3\u7406\u51fa\u4e00\u4e2a\u6574\u4f53\u7684\u5b9e\u73b0\u601d\u8def\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u7f16\u5199lua\u811a\u672c\uff0c\u6307\u5b9a\u5165\u53c2\u7684\u9650\u6d41\u89c4\u5219\uff0c\u6bd4\u5982\u5bf9\u7279\u5b9a\u7684\u63a5\u53e3\u9650\u6d41\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u67d0\u4e2a\u6216\u51e0\u4e2a\u53c2\u6570\u8fdb\u884c\u5224\u5b9a\uff0c\u8c03\u7528\u8be5\u63a5\u53e3\u7684\u8bf7\u6c42\uff0c\u5728\u4e00\u5b9a\u7684\u65f6\u95f4\u7a97\u53e3\u5185\u76d1\u63a7\u8bf7\u6c42\u6b21\u6570\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u65e2\u7136\u662f\u9650\u6d41\uff0c\u6700\u597d\u80fd\u591f\u901a\u7528\uff0c\u53ef\u5c06\u9650\u6d41\u89c4\u5219\u5e94\u7528\u5230\u4efb\u4f55\u63a5\u53e3\u4e0a\uff0c\u90a3\u4e48\u6700\u5408\u9002\u7684\u65b9\u5f0f\u5c31\u662f\u901a\u8fc7\u81ea\u5b9a\u4e49\u6ce8\u89e3\u5f62\u5f0f\u5207\u5165\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u63d0\u4f9b\u4e00\u4e2a\u914d\u7f6e\u7c7b\uff0c\u88abspring\u7684\u5bb9\u5668\u7ba1\u7406\uff0credisTemplate\u4e2d\u63d0\u4f9b\u4e86DefaultRedisScript\u8fd9\u4e2abean\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    \u63d0\u4f9b\u4e00\u4e2a\u80fd\u52a8\u6001\u89e3\u6790\u63a5\u53e3\u53c2\u6570\u7684\u7c7b\uff0c\u6839\u636e\u63a5\u53e3\u53c2\u6570\u8fdb\u884c\u89c4\u5219\u5339\u914d\u540e\u89e6\u53d1\u9650\u6d41\uff1b<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.1 \u5f15\u5165redis\u4f9d\u8d56<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter-data-redis<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.2 \u81ea\u5b9a\u4e49\u6ce8\u89e3<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>({ElementType.METHOD,&nbsp;ElementType.TYPE})\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)\n<span style=\"color: #61aeee;line-height: 26px;\">@Inherited<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Documented<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;RedisLimitAnnotation&nbsp;{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;key\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">key<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;\"\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Key\u7684\u524d\u7f00\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">prefix<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;\"\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u4e00\u5b9a\u65f6\u95f4\u5185\u6700\u591a\u8bbf\u95ee\u6b21\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">count<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u7ed9\u5b9a\u7684\u65f6\u95f4\u8303\u56f4&nbsp;\u5355\u4f4d(\u79d2)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">period<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u9650\u6d41\u7684\u7c7b\u578b(\u7528\u6237\u81ea\u5b9a\u4e49key\u6216\u8005\u8bf7\u6c42ip)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">LimitType&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limitType<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;LimitType.CUSTOMER<\/span>;\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.3 \u81ea\u5b9a\u4e49redis\u914d\u7f6e\u7c7b<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.context.annotation.Bean;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.core.io.ClassPathResource;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.connection.RedisConnectionFactory;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.core.RedisTemplate;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.core.script.DefaultRedisScript;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.serializer.StringRedisSerializer;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.scripting.support.ResourceScriptSource;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.io.Serializable;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">RedisConfiguration<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Bean<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;DefaultRedisScript&lt;Number&gt;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">redisluaScript<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DefaultRedisScript&lt;Number&gt;&nbsp;redisScript&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;DefaultRedisScript&lt;&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisScript.setScriptSource(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ResourceScriptSource(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ClassPathResource(<span style=\"color: #98c379;line-height: 26px;\">\"limit.lua\"<\/span>)));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisScript.setResultType(Number<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;redisScript;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Bean<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"redisTemplate\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;RedisTemplate&lt;String,&nbsp;Object&gt;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">redisTemplate<\/span><span style=\"line-height: 26px;\">(RedisConnectionFactory&nbsp;redisConnectionFactory)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RedisTemplate&lt;String,&nbsp;Object&gt;&nbsp;redisTemplate&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;RedisTemplate&lt;&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.setConnectionFactory(redisConnectionFactory);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jackson2JsonRedisSerializer&nbsp;jackson2JsonRedisSerializer&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;Jackson2JsonRedisSerializer(Object<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6evalue\u7684\u5e8f\u5217\u5316\u65b9\u5f0f\u4e3aJSOn<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6ekey\u7684\u5e8f\u5217\u5316\u65b9\u5f0f\u4e3aString<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.setKeySerializer(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;StringRedisSerializer());\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.setHashKeySerializer(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;StringRedisSerializer());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisTemplate.afterPropertiesSet();\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;redisTemplate;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.4 \u81ea\u5b9a\u4e49\u9650\u6d41AOP\u7c7b<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.ProceedingJoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Around;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Pointcut;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.reflect.MethodSignature;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.Logger;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.LoggerFactory;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.beans.factory.annotation.Autowired;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.context.annotation.Configuration;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.core.RedisTemplate;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.data.redis.core.script.DefaultRedisScript;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.RequestContextHolder;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.ServletRequestAttributes;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.servlet.http.HttpServletRequest;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.io.Serializable;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Collections;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.List;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Configuration<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">LimitRestAspect<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;Logger&nbsp;logger&nbsp;=&nbsp;LoggerFactory.getLogger(LimitRestAspect<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Autowired<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;RedisTemplate&lt;String,&nbsp;Object&gt;&nbsp;redisTemplate;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Autowired<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;DefaultRedisScript&lt;Number&gt;&nbsp;redisluaScript;\n&nbsp;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Pointcut<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.congge.config.limit.RedisLimitAnnotation)\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">rateLimit<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"rateLimit()\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">interceptor<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;joinPoint)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;Throwable&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MethodSignature&nbsp;signature&nbsp;=&nbsp;(MethodSignature)&nbsp;joinPoint.getSignature();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;method&nbsp;=&nbsp;signature.getMethod();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;&nbsp;targetClass&nbsp;=&nbsp;method.getDeclaringClass();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RedisLimitAnnotation&nbsp;rateLimit&nbsp;=&nbsp;method.getAnnotation(RedisLimitAnnotation<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(rateLimit&nbsp;!=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpServletRequest&nbsp;request&nbsp;=&nbsp;((ServletRequestAttributes)&nbsp;RequestContextHolder.getRequestAttributes()).getRequest();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;ipAddress&nbsp;=&nbsp;getIpAddr(request);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StringBuffer&nbsp;stringBuffer&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;StringBuffer();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stringBuffer.append(ipAddress).append(<span style=\"color: #98c379;line-height: 26px;\">\"-\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.append(targetClass.getName()).append(<span style=\"color: #98c379;line-height: 26px;\">\"-&nbsp;\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.append(method.getName()).append(<span style=\"color: #98c379;line-height: 26px;\">\"-\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.append(rateLimit.key());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;String&gt;&nbsp;keys&nbsp;=&nbsp;Collections.singletonList(stringBuffer.toString());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8c03\u7528lua\u811a\u672c\uff0c\u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\uff0c\u8fd9\u91cc\u5373\u4e3a\u8bf7\u6c42\u7684\u6b21\u6570<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Number&nbsp;number&nbsp;=&nbsp;redisTemplate.execute(\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redisluaScript,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keys,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimit.count(),\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimit.period()\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(number&nbsp;!=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;&amp;&amp;&nbsp;number.intValue()&nbsp;!=&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>&nbsp;&amp;&amp;&nbsp;number.intValue()&nbsp;&lt;=&nbsp;rateLimit.count())&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.info(<span style=\"color: #98c379;line-height: 26px;\">\"\u9650\u6d41\u65f6\u95f4\u6bb5\u5185\u8bbf\u95ee\u4e86\u7b2c\uff1a{}&nbsp;\u6b21\"<\/span>,&nbsp;number.toString());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;joinPoint.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;joinPoint.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throw<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;RuntimeException(<span style=\"color: #98c379;line-height: 26px;\">\"\u8bbf\u95ee\u9891\u7387\u8fc7\u5feb\uff0c\u88ab\u9650\u6d41\u4e86\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u83b7\u53d6\u8bf7\u6c42\u7684IP\u65b9\u6cd5\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@param<\/span>&nbsp;request\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@return<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getIpAddr<\/span><span style=\"line-height: 26px;\">(HttpServletRequest&nbsp;request)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;ipAddress&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;request.getHeader(<span style=\"color: #98c379;line-height: 26px;\">\"x-forwarded-for\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(ipAddress&nbsp;==&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;||&nbsp;ipAddress.length()&nbsp;==&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>&nbsp;||&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"unknown\"<\/span>.equalsIgnoreCase(ipAddress))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;request.getHeader(<span style=\"color: #98c379;line-height: 26px;\">\"Proxy-Client-IP\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(ipAddress&nbsp;==&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;||&nbsp;ipAddress.length()&nbsp;==&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>&nbsp;||&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"unknown\"<\/span>.equalsIgnoreCase(ipAddress))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;request.getHeader(<span style=\"color: #98c379;line-height: 26px;\">\"WL-Proxy-Client-IP\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(ipAddress&nbsp;==&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;||&nbsp;ipAddress.length()&nbsp;==&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>&nbsp;||&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"unknown\"<\/span>.equalsIgnoreCase(ipAddress))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;request.getRemoteAddr();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5bf9\u4e8e\u901a\u8fc7\u591a\u4e2a\u4ee3\u7406\u7684\u60c5\u51b5\uff0c\u7b2c\u4e00\u4e2aIP\u4e3a\u5ba2\u6237\u7aef\u771f\u5b9eIP,\u591a\u4e2aIP\u6309\u7167','\u5206\u5272<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(ipAddress&nbsp;!=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;&amp;&amp;&nbsp;ipAddress.length()&nbsp;&gt;&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">15<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(ipAddress.indexOf(<span style=\"color: #98c379;line-height: 26px;\">\",\"<\/span>)&nbsp;&gt;&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;ipAddress.substring(<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>,&nbsp;ipAddress.indexOf(<span style=\"color: #98c379;line-height: 26px;\">\",\"<\/span>));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ipAddress&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;ipAddress;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u8be5\u7c7b\u8981\u505a\u7684\u4e8b\u60c5\u548c\u4e0a\u9762\u7684\u4e24\u79cd\u9650\u6d41\u63aa\u65bd\u7c7b\u4f3c\uff0c\u4e0d\u8fc7\u5728\u8fd9\u91cc\u6838\u5fc3\u7684\u9650\u6d41\u662f\u901a\u8fc7\u8bfb\u53d6lua\u811a\u6b65\uff0c\u901a\u8fc7\u53c2\u6570\u4f20\u9012\u7ed9lua\u811a\u6b65\u5b9e\u73b0\u7684\u3002<\/p>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.5 \u81ea\u5b9a\u4e49lua\u811a\u672c<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728\u5de5\u7a0b\u7684resources\u76ee\u5f55\u4e0b\uff0c\u6dfb\u52a0\u5982\u4e0b\u7684lua\u811a\u672c<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">local<\/span>&nbsp;key&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"rate.limit:\"<\/span>&nbsp;..&nbsp;KEYS[<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>]\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">local<\/span>&nbsp;limit&nbsp;=&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">tonumber<\/span>(ARGV[<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>])\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">local<\/span>&nbsp;current&nbsp;=&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">tonumber<\/span>(redis.call(<span style=\"color: #98c379;line-height: 26px;\">'get'<\/span>,&nbsp;key)&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">or<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"0\"<\/span>)\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;current&nbsp;+&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>&nbsp;&gt;&nbsp;limit&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">then<\/span>\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>\n&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">--&nbsp;\u6ca1\u6709\u8d85\u9608\u503c\uff0c\u5c06\u5f53\u524d\u8bbf\u95ee\u6570\u91cf+1\uff0c\u5e76\u8bbe\u7f6e2\u79d2\u8fc7\u671f\uff08\u53ef\u6839\u636e\u81ea\u5df1\u7684\u4e1a\u52a1\u60c5\u51b5\u8c03\u6574\uff09<\/span>\n&nbsp;&nbsp;&nbsp;redis.call(<span style=\"color: #98c379;line-height: 26px;\">\"INCRBY\"<\/span>,&nbsp;key,<span style=\"color: #98c379;line-height: 26px;\">\"1\"<\/span>)\n&nbsp;&nbsp;&nbsp;redis.call(<span style=\"color: #98c379;line-height: 26px;\">\"expire\"<\/span>,&nbsp;key,<span style=\"color: #98c379;line-height: 26px;\">\"2\"<\/span>)\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;current&nbsp;+&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">end<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>4.3.6 \u6dfb\u52a0\u6d4b\u8bd5\u63a5\u53e3<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@RestController<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">RedisController<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/localhost:8081\/redis\/limit<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"\/redis\/limit\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@RedisLimitAnnotation<\/span>(key&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"queryFromRedis\"<\/span>,period&nbsp;=&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>,&nbsp;count&nbsp;=&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">queryFromRedis<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"success\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e3a\u4e86\u6a21\u62df\u6548\u679c\uff0c\u8fd9\u91cc\u5c06QPS\u8bbe\u7f6e\u4e3a1 \uff0c\u542f\u52a8\u5de5\u7a0b\u540e\uff08\u63d0\u524d\u542f\u52a8redis\u670d\u52a1\uff09\uff0c\u8c03\u7528\u4e00\u4e0b\u63a5\u53e3\uff0c\u6b63\u5e38\u7684\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.25678119349005424\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/20230714153406a4a4cc537.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"553\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.25678119349005424\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/20230714153406a4a4cc537.png\" png\"=\"\" data-w=\"553\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5feb\u901f\u5237\u63a5\u53e3\uff0c\u8d85\u8fc7\u6bcf\u79d21\u6b21\u7684\u8bf7\u6c42\u65f6\u770b\u5230\u5982\u4e0b\u6548\u679c<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.32915717539863326\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/20230714153407e9e9e9b8b.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"878\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.32915717539863326\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/20230714153407e9e9e9b8b.png\" png\"=\"\" data-w=\"878\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u4e94\u3001\u81ea\u5b9a\u4e49starter\u9650\u6d41\u5b9e\u73b0<\/h1>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e0a\u9762\u901a\u8fc7\u6848\u4f8b\u4ecb\u7ecd\u4e86\u51e0\u79cd\u5e38\u7528\u7684\u9650\u6d41\u5b9e\u73b0\uff0c\u4e0d\u8fc7\u7ec6\u5fc3\u7684\u540c\u5b66\u53ef\u4ee5\u770b\u5230\uff0c\u8fd9\u4e9b\u9650\u6d41\u7684\u5b9e\u73b0\u90fd\u662f\u5728\u5177\u4f53\u7684\u5de5\u7a0b\u6a21\u5757\u4e2d\u5d4c\u5165\u7684\uff0c\u4e8b\u5b9e\u4e0a\uff0c\u5728\u771f\u5b9e\u7684\u5fae\u670d\u52a1\u5f00\u53d1\u4e2d\uff0c\u4e00\u4e2a\u9879\u76ee\u53ef\u80fd\u5305\u542b\u4e86\u4f17\u591a\u7684\u5fae\u670d\u52a1\u6a21\u5757\uff0c\u4e3a\u4e86\u51cf\u5c11\u91cd\u590d\u9020\u8f6e\u5b50\uff0c\u907f\u514d\u6bcf\u4e2a\u5fae\u670d\u52a1\u6a21\u5757\u4e2d\u5355\u72ec\u5b9e\u73b0\uff0c\u53ef\u4ee5\u8003\u8651\u5c06\u9650\u6d41\u7684\u903b\u8f91\u5b9e\u73b0\u5c01\u88c5\u6210\u4e00\u4e2aSDK\uff0c\u5373\u4f5c\u4e3a\u4e00\u4e2aspringboot\u7684starter\u7684\u65b9\u5f0f\u88ab\u5176\u4ed6\u5fae\u670d\u52a1\u6a21\u5757\u8fdb\u884c\u5f15\u7528\u5373\u53ef\u3002\u8fd9\u4e5f\u662f\u76ee\u524d\u5f88\u591a\u751f\u4ea7\u5b9e\u8df5\u4e2d\u6bd4\u8f83\u901a\u7528\u7684\u505a\u6cd5\uff0c\u63a5\u4e0b\u6765\u770b\u770b\u5177\u4f53\u7684\u5b9e\u73b0\u5427\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.1 \u524d\u7f6e\u51c6\u5907<span style=\"display: none;\"><\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684springboot\u5de5\u7a0b\uff0c\u5de5\u7a0b\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\u56fe\uff0c\u76ee\u5f55\u8bf4\u660e\uff1a<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(0, 150, 136);\">annotation<\/code>\uff1a\u5b58\u653e\u81ea\u5b9a\u4e49\u7684\u9650\u6d41\u76f8\u5173\u7684\u6ce8\u89e3\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(0, 150, 136);\">aop<\/code>\uff1a\u5b58\u653e\u4e0d\u540c\u7684\u9650\u6d41\u5b9e\u73b0\uff0c\u6bd4\u5982\u57fa\u4e8eguava\u7684aop\uff0c\u57fa\u4e8esentinel\u7684aop\u5b9e\u73b0\u7b49\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    <code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(0, 150, 136);\">spring.factories<\/code>\uff1a\u81ea\u5b9a\u4e49\u5f85\u88c5\u914d\u7684aop\u5b9e\u73b0\u7c7b\uff1b<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"1.331896551724138\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534073333d9195.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"464\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"1.331896551724138\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534073333d9195.png\" png\"=\"\" data-w=\"464\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 20px;margin: 0.6em auto;padding-left: 10px;border-left: 2px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2 \u4ee3\u7801\u6574\u5408\u5b8c\u6210\u6b65\u9aa4<span style=\"display: none;\"><\/span><\/h3>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.1 \u5bfc\u5165\u57fa\u7840\u7684\u4f9d\u8d56<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u8fd9\u91cc\u5305\u62ec\u5982\u4e0b\u51e0\u4e2a\u5fc5\u987b\u7684\u4f9d\u8d56\uff0c\u5176\u4ed6\u7684\u4f9d\u8d56\u53ef\u4ee5\u7ed3\u5408\u81ea\u8eab\u7684\u60c5\u51b5\u5408\u7406\u9009\u62e9\uff1b<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    spring-boot-starter\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    guava\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    spring-boot-autoconfigure\uff1b<br \/>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);\">\n    sentinel-core\uff1b<br \/>\n<\/section>\n<\/li>\n<\/ul>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">parent<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter-parent<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>2.2.1.RELEASE<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">relativePath<\/span>\/&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">parent<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">properties<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">project.build.sourceEncoding<\/span>&gt;<\/span>UTF-8<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">project.build.sourceEncoding<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">project.reporting.outputEncoding<\/span>&gt;<\/span>UTF-8<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">project.reporting.outputEncoding<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">java.version<\/span>&gt;<\/span>1.8<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">java.version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">properties<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependencies<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter-aop<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>log4j<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>log4j<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>1.2.17<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter-web<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.projectlombok<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>lombok<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">&lt;!--&nbsp;guava--&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.google.guava<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>guava<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>23.0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-autoconfigure<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>2.2.1.RELEASE<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-configuration-processor<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>2.2.1.RELEASE<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.alibaba.csp<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>sentinel-core<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>1.8.0<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>org.apache.commons<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>commons-lang3<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>3.4<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>com.alibaba.fastjson2<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>fastjson2<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>2.0.22<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependencies<\/span>&gt;<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">build<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">resources<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">resource<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">directory<\/span>&gt;<\/span>src\/main\/resources<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">directory<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">includes<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">include<\/span>&gt;<\/span>**\/**<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">include<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">includes<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">resource<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">resources<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">build<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.2 \u81ea\u5b9a\u4e49\u6ce8\u89e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u76ee\u524d\u8be5SDK\u652f\u6301\u4e09\u79cd\u9650\u6d41\u65b9\u5f0f\uff0c\u5373\u540e\u7eed\u5176\u4ed6\u5fae\u670d\u52a1\u5de5\u7a0b\u4e2d\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u8fd93\u79cd\u6ce8\u89e3\u5373\u53ef\u5b9e\u73b0\u9650\u6d41\uff0c\u5206\u522b\u662f\u57fa\u4e8eguava\u7684\u4ee4\u724c\u6876\uff0c\u57fa\u4e8esentinel\u7684\u9650\u6d41\uff0c\u57fa\u4e8ejava\u81ea\u5e26\u7684Semaphore\u9650\u6d41\uff0c\u4e09\u4e2a\u81ea\u5b9a\u4e49\u6ce8\u89e3\u7c7b\u5982\u4e0b\uff1a<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4ee4\u724c\u6876<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Documented<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>(ElementType.METHOD)\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;TokenBucketLimiter&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">value<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;50<\/span>;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">Semaphore<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Documented<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>(ElementType.METHOD)\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;ShLimiter&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">value<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;50<\/span>;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">sentinel<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #61aeee;line-height: 26px;\">@Target<\/span>(value&nbsp;=&nbsp;ElementType.METHOD)\n<span style=\"color: #61aeee;line-height: 26px;\">@Retention<\/span>(value&nbsp;=&nbsp;RetentionPolicy.RUNTIME)\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@interface<\/span>&nbsp;SentinelLimiter&nbsp;{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">resourceName<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">limitCount<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">default<\/span>&nbsp;50<\/span>;\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.3 \u9650\u6d41\u5b9e\u73b0AOP\u7c7b<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5177\u4f53\u7684\u9650\u6d41\u5728AOP\u4e2d\u8fdb\u884c\u5b9e\u73b0\uff0c\u601d\u8def\u548c\u4e0a\u4e00\u7ae0\u8282\u7c7b\u4f3c\uff0c\u5373\u901a\u8fc7\u73af\u7ed5\u901a\u77e5\u7684\u65b9\u5f0f\uff0c\u5148\u89e3\u6790\u90a3\u4e9b\u6dfb\u52a0\u4e86\u9650\u6d41\u6ce8\u89e3\u7684\u65b9\u6cd5\uff0c\u7136\u540e\u89e3\u6790\u91cc\u9762\u7684\u53c2\u6570\uff0c\u8fdb\u884c\u9650\u6d41\u7684\u4e1a\u52a1\u5b9e\u73b0\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u57fa\u4e8eguava\u7684aop\u5b9e\u73b0<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.fastjson2.JSONObject;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.congge.annotation.TokenBucketLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.google.common.util.concurrent.RateLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;lombok.extern.slf4j.Slf4j;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.ProceedingJoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Around;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Pointcut;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.cglib.core.ReflectUtils;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.RequestContextHolder;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.context.request.ServletRequestAttributes;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.servlet.ServletOutputStream;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.servlet.http.HttpServletResponse;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.io.IOException;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Arrays;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Map;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.concurrent.ConcurrentHashMap;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">GuavaLimiterAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;Map&lt;String,&nbsp;RateLimiter&gt;&nbsp;rateLimiters&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ConcurrentHashMap&lt;String,&nbsp;RateLimiter&gt;();\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Pointcut<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.congge.annotation.TokenBucketLimiter)\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">aspect<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"aspect()\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">around<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;point)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;Throwable&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(<span style=\"color: #98c379;line-height: 26px;\">\"\u51c6\u5907\u9650\u6d41\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;target&nbsp;=&nbsp;point.getTarget();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;targetName&nbsp;=&nbsp;target.getClass().getName();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;methodName&nbsp;=&nbsp;point.getSignature().getName();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object[]&nbsp;arguments&nbsp;=&nbsp;point.getArgs();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;&nbsp;targetClass&nbsp;=&nbsp;Class.forName(targetName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;[]&nbsp;argTypes&nbsp;=&nbsp;ReflectUtils.getClasses(arguments);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;method&nbsp;=&nbsp;targetClass.getDeclaredMethod(methodName,&nbsp;argTypes);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u76ee\u6807method\u4e0a\u7684\u9650\u6d41\u6ce8\u89e3@Limiter<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TokenBucketLimiter&nbsp;limiter&nbsp;=&nbsp;method.getAnnotation(TokenBucketLimiter<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RateLimiter&nbsp;rateLimiter&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;result&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;!=&nbsp;limiter)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u4ee5&nbsp;class&nbsp;+&nbsp;method&nbsp;+&nbsp;parameters\u4e3akey\uff0c\u907f\u514d\u91cd\u8f7d\u3001\u91cd\u5199\u5e26\u6765\u7684\u6df7\u4e71<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;key&nbsp;=&nbsp;targetName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\".\"<\/span>&nbsp;+&nbsp;methodName&nbsp;+&nbsp;Arrays.toString(argTypes);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimiter&nbsp;=&nbsp;rateLimiters.get(key);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;==&nbsp;rateLimiter)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u9650\u5b9a\u7684\u6d41\u91cf<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u4e3a\u4e86\u9632\u6b62\u5e76\u53d1<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimiters.putIfAbsent(key,&nbsp;RateLimiter.create(limiter.value()));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rateLimiter&nbsp;=&nbsp;rateLimiters.get(key);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">boolean<\/span>&nbsp;b&nbsp;=&nbsp;rateLimiter.tryAcquire();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>(b){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(<span style=\"color: #98c379;line-height: 26px;\">\"\u5f97\u5230\u4ee4\u724c\uff0c\u51c6\u5907\u6267\u884c\u4e1a\u52a1\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;point.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpServletResponse&nbsp;resp&nbsp;=&nbsp;((ServletRequestAttributes)&nbsp;RequestContextHolder.getRequestAttributes()).getResponse();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JSONObject&nbsp;jsonObject=<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;JSONObject();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonObject.put(<span style=\"color: #98c379;line-height: 26px;\">\"success\"<\/span>,<span style=\"color: #c678dd;line-height: 26px;\">false<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonObject.put(<span style=\"color: #98c379;line-height: 26px;\">\"msg\"<\/span>,<span style=\"color: #98c379;line-height: 26px;\">\"\u9650\u6d41\u4e2d\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;output(resp,&nbsp;jsonObject.toJSONString());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.error(<span style=\"color: #98c379;line-height: 26px;\">\"error,e:{}\"<\/span>,e);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;point.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(<span style=\"color: #98c379;line-height: 26px;\">\"\u9000\u51fa\u9650\u6d41\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;result;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">output<\/span><span style=\"line-height: 26px;\">(HttpServletResponse&nbsp;response,&nbsp;String&nbsp;msg)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;IOException&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.setContentType(<span style=\"color: #98c379;line-height: 26px;\">\"application\/json;charset=UTF-8\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ServletOutputStream&nbsp;outputStream&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream&nbsp;=&nbsp;response.getOutputStream();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.write(msg.getBytes(<span style=\"color: #98c379;line-height: 26px;\">\"UTF-8\"<\/span>));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(IOException&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">finally<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.flush();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outputStream.close();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u57fa\u4e8eSemaphore\u7684aop\u5b9e\u73b0<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.congge.annotation.ShLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;lombok.extern.slf4j.Slf4j;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.ProceedingJoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Around;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Pointcut;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.Logger;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.slf4j.LoggerFactory;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.cglib.core.ReflectUtils;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Arrays;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Map;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.concurrent.ConcurrentHashMap;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.concurrent.Semaphore;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Slf<\/span>4j\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">SemaphoreLimiterAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;Map&lt;String,&nbsp;Semaphore&gt;&nbsp;semaphores&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ConcurrentHashMap&lt;String,&nbsp;Semaphore&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">final<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;Logger&nbsp;LOG&nbsp;=&nbsp;LoggerFactory.getLogger(SemaphoreLimiterAop<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Pointcut<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.congge.annotation.ShLimiter)\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">aspect<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"aspect()\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">around<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;point)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;Throwable&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(<span style=\"color: #98c379;line-height: 26px;\">\"\u8fdb\u5165\u9650\u6d41aop\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;target&nbsp;=&nbsp;point.getTarget();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;targetName&nbsp;=&nbsp;target.getClass().getName();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;methodName&nbsp;=&nbsp;point.getSignature().getName();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object[]&nbsp;arguments&nbsp;=&nbsp;point.getArgs();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;&nbsp;targetClass&nbsp;=&nbsp;Class.forName(targetName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;[]&nbsp;argTypes&nbsp;=&nbsp;ReflectUtils.getClasses(arguments);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;method&nbsp;=&nbsp;targetClass.getDeclaredMethod(methodName,&nbsp;argTypes);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u76ee\u6807method\u4e0a\u7684\u9650\u6d41\u6ce8\u89e3@Limiter<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ShLimiter&nbsp;limiter&nbsp;=&nbsp;method.getAnnotation(ShLimiter<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;result&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;!=&nbsp;limiter)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u4ee5&nbsp;class&nbsp;+&nbsp;method&nbsp;+&nbsp;parameters\u4e3akey\uff0c\u907f\u514d\u91cd\u8f7d\u3001\u91cd\u5199\u5e26\u6765\u7684\u6df7\u4e71<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;key&nbsp;=&nbsp;targetName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\".\"<\/span>&nbsp;+&nbsp;methodName&nbsp;+&nbsp;Arrays.toString(argTypes);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u83b7\u53d6\u9650\u5b9a\u7684\u6d41\u91cf<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Semaphore&nbsp;semaphore&nbsp;=&nbsp;semaphores.get(key);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;==&nbsp;semaphore)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semaphores.putIfAbsent(key,&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;Semaphore(limiter.value()));\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semaphore&nbsp;=&nbsp;semaphores.get(key);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semaphore.acquire();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;point.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">finally<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>&nbsp;!=&nbsp;semaphore)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semaphore.release();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;point.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(<span style=\"color: #98c379;line-height: 26px;\">\"\u9000\u51fa\u9650\u6d41\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;result;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u57fa\u4e8esentinel\u7684aop\u5b9e\u73b0<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.Entry;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.SphU;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.Tracer;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.BlockException;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.RuleConstant;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.flow.FlowRule;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.congge.annotation.SentinelLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.apache.commons.lang3.StringUtils;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.JoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.ProceedingJoinPoint;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Around;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Aspect;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.aspectj.lang.annotation.Pointcut;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Component;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.lang.reflect.Method;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.ArrayList;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.List;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Objects;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@Aspect<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Component<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">SentinelLimiterAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">static<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">initFlowRule<\/span><span style=\"line-height: 26px;\">(String&nbsp;resourceName,<span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;limitCount)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;FlowRule&gt;&nbsp;rules&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ArrayList&lt;&gt;();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FlowRule&nbsp;rule&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;FlowRule();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u53d7\u4fdd\u62a4\u7684\u8d44\u6e90<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setResource(resourceName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u6d41\u63a7\u89c4\u5219&nbsp;QPS<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setGrade(RuleConstant.FLOW_GRADE_QPS);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u53d7\u4fdd\u62a4\u7684\u8d44\u6e90\u9608\u503c<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule.setCount(limitCount);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rules.add(rule);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u52a0\u8f7d\u914d\u7f6e\u597d\u7684\u89c4\u5219<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FlowRuleManager.loadRules(rules);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Pointcut<\/span>(value&nbsp;=&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.congge.annotation.SentinelLimiter)\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">rateLimit<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"rateLimit()\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">around<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/1\u3001\u83b7\u53d6\u5f53\u524d\u7684\u8c03\u7528\u65b9\u6cd5<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;currentMethod&nbsp;=&nbsp;getCurrentMethod(joinPoint);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(Objects.isNull(currentMethod))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/2\u3001\u4ece\u65b9\u6cd5\u6ce8\u89e3\u5b9a\u4e49\u4e0a\u83b7\u53d6\u9650\u6d41\u7684\u7c7b\u578b<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;resourceName&nbsp;=&nbsp;currentMethod.getAnnotation(SentinelLimiter<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">resourceName<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>(StringUtils.isEmpty(resourceName)){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throw<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;RuntimeException(<span style=\"color: #98c379;line-height: 26px;\">\"\u8d44\u6e90\u540d\u79f0\u4e3a\u7a7a\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">int<\/span>&nbsp;limitCount&nbsp;=&nbsp;currentMethod.getAnnotation(SentinelLimiter<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>).<span style=\"color: #e6c07b;line-height: 26px;\">limitCount<\/span>()<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initFlowRule(resourceName,limitCount);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Entry&nbsp;entry&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;result&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entry&nbsp;=&nbsp;SphU.entry(resourceName);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;joinPoint.proceed();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Throwable&nbsp;throwable)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throwable.printStackTrace();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(BlockException&nbsp;ex)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u8d44\u6e90\u8bbf\u95ee\u963b\u6b62\uff0c\u88ab\u9650\u6d41\u6216\u88ab\u964d\u7ea7<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5728\u6b64\u5904\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u64cd\u4f5c<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style=\"color: #98c379;line-height: 26px;\">\"blocked\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u88ab\u9650\u6d41\u4e86\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tracer.traceEntry(e,&nbsp;entry);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">finally<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(entry&nbsp;!=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entry.exit();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;result;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;Method&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">getCurrentMethod<\/span><span style=\"line-height: 26px;\">(JoinPoint&nbsp;joinPoint)<\/span>&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method[]&nbsp;methods&nbsp;=&nbsp;joinPoint.getTarget().getClass().getMethods();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;target&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">for<\/span>&nbsp;(Method&nbsp;method&nbsp;:&nbsp;methods)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(method.getName().equals(joinPoint.getSignature().getName()))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;=&nbsp;method;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">break<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;target;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.4 \u914d\u7f6e\u81ea\u52a8\u88c5\u914dAOP\u5b9e\u73b0<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728resources\u76ee\u5f55\u4e0b\u521b\u5efa\u4e0a\u8ff0\u7684<code style=\"font-size: 14px;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(0, 150, 136);\">spring.factories<\/code>\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u914d\u7f6e\u540e\uff0c\u5176\u4ed6\u5e94\u7528\u6a21\u5757\u5f15\u5165\u4e86\u5f53\u524d\u7684SDK\u7684jar\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5f00\u7bb1\u5373\u7528\u4e86\uff1b<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\">org.springframework.boot.autoconfigure.EnableAutoConfiguration=\\\n&nbsp;&nbsp;com.congge.aop.SemaphoreLimiterAop,\\\n&nbsp;&nbsp;com.congge.aop.GuavaLimiterAop,\\\n&nbsp;&nbsp;com.congge.aop.SemaphoreLimiterAop\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.5 \u5c06\u5de5\u7a0b\u6253\u6210jar\u8fdb\u884c\u5b89\u88c5<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u8fd9\u4e00\u6b65\u6bd4\u8f83\u7b80\u5355\u5c31\u8df3\u8fc7\u4e86<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.18981481481481483\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534078c8c6c6a9.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.18981481481481483\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534078c8c6c6a9.png\" png\"=\"\" data-w=\"1080\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.6 \u5728\u5176\u4ed6\u7684\u5de5\u7a0b\u4e2d\u5f15\u5165\u4e0a\u8ff0SDK<span style=\"display: none;\"><\/span><\/h5>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>cm.congge<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">groupId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>biz-limit<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">artifactId<\/span>&gt;<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>1.0-SNAPSHOT<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">version<\/span>&gt;<\/span>\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75;line-height: 26px;\">dependency<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.7 \u7f16\u5199\u6d4b\u8bd5\u63a5\u53e3<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5728\u5176\u4ed6\u5de5\u7a0b\u4e2d\uff0c\u7f16\u5199\u4e00\u4e2a\u6d4b\u8bd5\u63a5\u53e3\uff0c\u5e76\u4f7f\u7528\u4e0a\u9762\u7684\u6ce8\u89e3\uff0c\u8fd9\u91cc\u4ee5guava\u7684\u9650\u6d41\u6ce8\u89e3\u4e3a\u4f8b\u8fdb\u884c\u8bf4\u660e<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><span style=\"display: block;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/wJibWkqN1bUMGV1UTPd8Fdvp0GgiaShZakKicqXCvvawv5oxnn7YoSXwmb3icyt52YnANTicoJTHicHXg8ek3pqIlhljAXodPYPyHib\/640?wx_fmt=svg&quot;) 10px 10px \/ 40px no-repeat rgb(40, 44, 52);height: 30px;width: 100%;margin-bottom: -7px;border-radius: 5px;\"><\/span><code style=\"overflow-x: auto;padding: 16px;color: #abb2bf;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;font-size: 12px;-webkit-overflow-scrolling: touch;padding-top: 15px;background: #282c34;border-radius: 5px;\"><span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.congge.annotation.TokenBucketLimiter;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.bind.annotation.GetMapping;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.web.bind.annotation.RestController;\n&nbsp;\n<span style=\"color: #61aeee;line-height: 26px;\">@RestController<\/span>\n<span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">class<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">SdkController<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/localhost:8081\/query<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@GetMapping<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"\/query\"<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@TokenBucketLimiter<\/span>(<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">queryUser<\/span><span style=\"line-height: 26px;\">()<\/span><\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"queryUser\"<\/span>;\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<h5 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;margin: 0.6em auto;font-size: 1.1em;padding-left: 10px;border-left: 1px dashed rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>5.2.8 \u529f\u80fd\u6d4b\u8bd5<span style=\"display: none;\"><\/span><\/h5>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u542f\u52a8\u5f53\u524d\u7684\u5de5\u7a0b\u540e\uff0c\u6b63\u5e38\u8c03\u7528\u63a5\u53e3\uff0c\u6bcf\u79d2\u4e00\u6b21\u7684\u8bf7\u6c42\uff0c\u53ef\u4ee5\u6b63\u5e38\u5f97\u5230\u7ed3\u679c<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.20872865275142316\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/2023071415340859598962d.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"527\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.20872865275142316\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/2023071415340859598962d.png\" png\"=\"\" data-w=\"527\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u5feb\u901f\u5237\u63a5\u53e3\uff0cQPS\u8d85\u8fc71\u4e4b\u540e\uff0c\u5c06\u4f1a\u89e6\u53d1\u9650\u6d41\uff0c\u770b\u5230\u5982\u4e0b\u6548\u679c<\/p>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;display: flex;flex-direction: column;justify-content: center;align-items: center;\">\n  <img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.2810077519379845\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/202307141534085b5bc7ffd.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" png\"=\"\" data-w=\"516\" style=\"display: block;margin-right: auto;margin-left: auto;\"><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.2810077519379845\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/202307141534085b5bc7ffd.png\" png\"=\"\" data-w=\"516\" style=\"display: block;margin-right: auto;margin-left: auto;\"><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u901a\u8fc7\u4e0a\u9762\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4e5f\u53ef\u4ee5\u5f97\u5230\u9884\u671f\u7684\u6548\u679c\uff0c\u5176\u4ed6\u4e24\u79cd\u9650\u6d41\u6ce8\u89e3\u6709\u5174\u8da3\u7684\u540c\u5b66\u4e5f\u53ef\u4ee5\u7ee7\u7eed\u6d4b\u8bd5\u9a8c\u8bc1\uff0c\u7bc7\u5e45\u539f\u56e0\u5c31\u4e0d\u518d\u8d58\u8ff0\u4e86\u3002<\/p>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"border-top: none;border-bottom: none;font-size: 0.9em;overflow: auto;background: rgba(0, 0, 0, 0.05);padding: 10px 10px 10px 1em;margin-bottom: 20px;margin-top: 20px;border-left-width: 2px;border-left-color: rgb(136, 136, 136);border-right: 2px solid rgb(136, 136, 136);color: rgb(119, 119, 119);\">\n<p style=\"font-size: 16px;padding-top: 8px;padding-bottom: 8px;text-align: justify;color: black;line-height: 26px;\">\u4e0a\u8ff0\u901a\u8fc7starter\u7684\u65b9\u5f0f\u5b9e\u73b0\u4e86\u4e00\u79cd\u66f4\u4f18\u96c5\u7684\u9650\u6d41\u96c6\u6210\u65b9\u5f0f\uff0c\u4e5f\u662f\u751f\u4ea7\u4e2d\u6bd4\u8f83\u63a8\u8350\u7684\u4e00\u79cd\u65b9\u5f0f\uff0c\u4e0d\u8fc7\u5f53\u524d\u7684\u6848\u4f8b\u8fd8\u6bd4\u8f83\u7c97\u7cd9\uff0c\u9700\u8981\u4f7f\u7528\u7684\u540c\u5b66\u8fd8\u9700\u6839\u636e\u81ea\u5df1\u7684\u60c5\u51b5\u5b8c\u5584\u91cc\u9762\u7684\u903b\u8f91\uff0c\u8fdb\u4e00\u6b65\u7684\u5c01\u88c5\u4ee5\u671f\u5f97\u5230\u66f4\u597d\u7684\u6548\u679c\u3002<\/p>\n<\/blockquote>\n<h1 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 1.8em;color: rgb(0, 150, 136);margin: 1.2em auto;text-align: center;border-bottom: 1px solid rgb(0, 150, 136);\"><span style=\"display: none;\"><\/span>\u516d\u3001\u5199\u5728\u6587\u672b<\/h1>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u672c\u6587\u901a\u8fc7\u8f83\u5927\u7684\u7bc7\u5e45\u7ed3\u5408\u5b9e\u9645\u6848\u4f8b\u8be6\u7ec6\u9610\u8ff0\u4e86\u5fae\u670d\u52a1\u4e2d\u9650\u6d41\u7684\u4e00\u4e9b\u5b9e\u73b0\u65b9\u6848\uff0c\u9650\u6d41\u5bf9\u4e8e\u4e00\u4e2a\u7a33\u5b9a\u8fd0\u884c\u7684\u7cfb\u7edf\u6765\u8bf4\u5177\u6709\u5f88\u91cd\u8981\u7684\u610f\u4e49\uff0c\u53ef\u4ee5\u8bf4\u662f\u670d\u52a1\u6cbb\u7406\u4e2d\u4e00\u4e2a\u91cd\u8981\u7684\u65b9\u9762\uff0c\u5e0c\u671b\u5bf9\u770b\u5230\u7684\u540c\u5b66\u6709\u6240\u5e2e\u52a9\uff0c\u8c22\u8c22\u89c2\u770b\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: center;\"><span style=\"font-size: 14px;\">\u6765\u6e90\uff1ablog.csdn.net\/zhangcongyi420\/article\/details\/131342759<\/span><\/p>\n<\/section>\n<p style=\"display: none;\">\n <mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7\uff1ahttps:\/\/mp.weixin.qq.com\/s\/JGNokseEXSeMbXsStf3SxQ<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u80cc\u666f \u9650\u6d41\u5bf9\u4e8e\u4e00\u4e2a\u5fae\u670d\u52a1\u67b6\u6784\u7cfb\u7edf\u6765\u8bf4\u5177\u6709\u975e\u5e38\u91cd\u8981\u7684\u610f\u4e49\uff0c\u5426\u5219\u5176\u4e2d\u7684\u67d0\u4e2a\u5fae\u670d\u52a1\u5c06\u6210\u4e3a\u6574\u4e2a\u7cfb\u7edf\u9690\u85cf\u7684\u96ea\u5d29\u56e0\u7d20\uff0c\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bf4\uff1f \u4e3e\u4f8b &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[6,7,8],"tags":[],"class_list":["post-2943","post","type-post","status-publish","format-standard","hentry","category-spring","category-spring-boot","category-spring-cloud"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-03\/20230714153403b6b67f396.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404dbdbf1dcf.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404dbdbf1dcf.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/2023071415340445451598e.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/2023071415340445451598e.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404bdbd2d9ea.png","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-04\/20230714153404bdbd2d9ea.png","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405575771e9b.png","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405575771e9b.png","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405b1b13e264.png","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405b1b13e264.png","id":"image11"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405c9c99635f.png","id":"image12"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-05\/20230714153405c9c99635f.png","id":"image13"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/202307141534066e6ebf82a.png","id":"image14"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/202307141534066e6ebf82a.png","id":"image15"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/20230714153406a4a4cc537.png","id":"image16"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-06\/20230714153406a4a4cc537.png","id":"image17"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/20230714153407e9e9e9b8b.png","id":"image18"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/20230714153407e9e9e9b8b.png","id":"image19"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534073333d9195.png","id":"image20"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534073333d9195.png","id":"image21"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534078c8c6c6a9.png","id":"image22"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-07\/202307141534078c8c6c6a9.png","id":"image23"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/2023071415340859598962d.png","id":"image24"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/2023071415340859598962d.png","id":"image25"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/202307141534085b5bc7ffd.png","id":"image26"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/15-34-08\/202307141534085b5bc7ffd.png","id":"image27"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring","post_date":"2023-07-14","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":655,"next_post_id":2961,"next_post_title":"40 \u4e2a SpringBoot \u5e38\u7528\u6ce8\u89e3\uff1a\u8ba9\u751f\u4ea7\u529b\u7206\u8868\uff01","previous_post_id":2941,"previous_post_title":"Mybatis\u7cfb\u5217\u7b2c12\u7bc7\uff1a\u638c\u63e1\u7f13\u5b58\u4e3a\u67e5\u8be2\u63d0\u901f!","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2943"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2943\/revisions"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}