{"id":2937,"date":"2023-07-14T15:30:35","date_gmt":"2023-07-14T07:30:35","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=2937"},"modified":"2023-07-14T15:30:35","modified_gmt":"2023-07-14T07:30:35","slug":"springboot-%e4%b8%ad%e7%9a%84%e5%a4%9a%e7%ba%bf%e7%a8%8b%e4%ba%8b%e5%8a%a1%e5%a4%84%e7%90%86%e5%a4%aa%e7%b9%81%e7%90%90%ef%bc%9f%e4%b8%80%e4%b8%aa%e8%87%aa%e5%ae%9a%e4%b9%89%e6%b3%a8%e8%a7%a3%e7%9b%b4","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring\/springboot-%e4%b8%ad%e7%9a%84%e5%a4%9a%e7%ba%bf%e7%a8%8b%e4%ba%8b%e5%8a%a1%e5%a4%84%e7%90%86%e5%a4%aa%e7%b9%81%e7%90%90%ef%bc%9f%e4%b8%80%e4%b8%aa%e8%87%aa%e5%ae%9a%e4%b9%89%e6%b3%a8%e8%a7%a3%e7%9b%b4\/","title":{"rendered":"SpringBoot \u4e2d\u7684\u591a\u7ebf\u7a0b\u4e8b\u52a1\u5904\u7406\u592a\u7e41\u7410\uff1f\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6ce8\u89e3\u76f4\u63a5\u641e\u5b9a\uff01"},"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<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>\u524d\u8a00<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;\">\u6211\u4eec\u5f00\u53d1\u7684\u65f6\u5019\u5e38\u5e38\u4f1a\u9047\u5230\u591a\u7ebf\u7a0b\u4e8b\u52a1\u7684\u95ee\u9898\u3002\u4ee5\u4e3a\u6dfb\u52a0\u4e86<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);\">@Transactional<\/code>\u6ce8\u89e3\u5c31\u884c\u4e86\uff0c\u5176\u5b9e\u4f60\u52a0\u4e86\u6ce8\u89e3\u4e4b\u540e\u4f1a\u53d1\u73b0\u4e8b\u52a1\u5931\u6548\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u539f\u56e0\uff1a\u6570\u636e\u5e93\u8fde\u63a5spring\u662f\u653e\u5728threadLocal\u91cc\u9762\uff0c\u591a\u7ebf\u7a0b\u573a\u666f\u4e0b\uff0c\u62ff\u5230\u7684\u6570\u636e\u5e93\u8fde\u63a5\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u5373\u662f\u5c5e\u4e8e\u4e0d\u540c\u4e8b\u52a1\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u672c\u6587\u662f\u57fa\u4e8espringboot\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);\">@Async<\/code>\u6ce8\u89e3\u5f00\u542f\u591a\u7ebf\u7a0b,\uff0c\u5e76\u901a\u8fc7\u81ea\u5b9a\u4e49\u6ce8\u89e3\u548cAOP\u5b9e\u73b0\u7684\u591a\u7ebf\u7a0b\u4e8b\u52a1\uff0c\u907f\u514d\u7e41\u7410\u7684\u624b\u52a8\u63d0\u4ea4\/\u56de\u6eda\u4e8b\u52a1 &nbsp;(CV\u5373\u7528\u3001\u53c2\u6570\u9f50\u5168\u3001\u65e0\u9700\u914d\u7f6e)<\/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>\u4e00\u3001springboot\u591a\u7ebf\u7a0b(\u58f0\u660e\u5f0f)\u7684\u4f7f\u7528\u65b9\u6cd5\uff1f<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;\">1\u3001springboot\u63d0\u4f9b\u4e86\u6ce8\u89e3<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);\">@Async<\/code>\u6765\u4f7f\u7528\u7ebf\u7a0b\u6c60\uff0c\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">(1) \u5728\u542f\u52a8\u7c7b(\u914d\u7f6e\u7c7b)\u6dfb\u52a0<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);\">@EnableAsync<\/code>\u6765\u5f00\u542f\u7ebf\u7a0b\u6c60<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">(2) \u5728\u9700\u8981\u5f00\u542f\u5b50\u7ebf\u7a0b\u7684\u65b9\u6cd5\u4e0a\u6dfb\u52a0\u6ce8\u89e3<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);\">@Async<\/code><\/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;\">\u6ce8\u610f: \u6846\u67b6\u9ed8\u8ba4 -----&gt; &nbsp; \u6765\u4e00\u4e2a\u8bf7\u6c42\u5f00\u542f\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5728\u9ad8\u5e76\u53d1\u4e0b\u5bb9\u6613\u5185\u5b58\u6ea2\u51fa<\/p>\n<\/blockquote>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u6240\u4ee5\u4f7f\u7528\u65f6\u9700\u8981\u914d\u7f6e\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\uff0c\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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">@Configuration<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@EnableAsync<\/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;\">ThreadPoolTaskConfig<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Bean<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"threadPoolTaskExecutor\"<\/span>)<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\u540d\u79f0<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\"><span style=\"color: #c678dd;line-height: 26px;\">public<\/span>&nbsp;ThreadPoolTaskExecutor&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">threadPoolTaskExecutor<\/span><span style=\"line-height: 26px;\">()<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThreadPoolTaskExecutor&nbsp;executor&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ThreadPoolTaskExecutor();\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u7ebf\u7a0b\u6c60\u521b\u5efa\u7684\u6838\u5fc3\u7ebf\u7a0b\u6570\uff0c\u7ebf\u7a0b\u6c60\u7ef4\u62a4\u7ebf\u7a0b\u7684\u6700\u5c11\u6570\u91cf\uff0c\u5373\u4f7f\u6ca1\u6709\u4efb\u52a1\u9700\u8981\u6267\u884c\uff0c\u4e5f\u4f1a\u4e00\u76f4\u5b58\u6d3b<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setCorePoolSize(<span style=\"color: #d19a66;line-height: 26px;\">16<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5982\u679c\u8bbe\u7f6eallowCoreThreadTimeout=true\uff08\u9ed8\u8ba4false\uff09\u65f6\uff0c\u6838\u5fc3\u7ebf\u7a0b\u4f1a\u8d85\u65f6\u5173\u95ed<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/executor.setAllowCoreThreadTimeOut(true);<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u963b\u585e\u961f\u5217&nbsp;\u5f53\u6838\u5fc3\u7ebf\u7a0b\u6570\u8fbe\u5230\u6700\u5927\u65f6\uff0c\u65b0\u4efb\u52a1\u4f1a\u653e\u5728\u961f\u5217\u4e2d\u6392\u961f\u7b49\u5f85\u6267\u884c<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setQueueCapacity(<span style=\"color: #d19a66;line-height: 26px;\">124<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u6700\u5927\u7ebf\u7a0b\u6c60\u6570\u91cf\uff0c\u5f53\u7ebf\u7a0b\u6570&gt;=corePoolSize\uff0c\u4e14\u4efb\u52a1\u961f\u5217\u5df2\u6ee1\u65f6\u3002\u7ebf\u7a0b\u6c60\u4f1a\u521b\u5efa\u65b0\u7ebf\u7a0b\u6765\u5904\u7406\u4efb\u52a1<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u4efb\u52a1\u961f\u5217\u5df2\u6ee1\u65f6,&nbsp;\u4e14\u5f53\u7ebf\u7a0b\u6570=maxPoolSize\uff0c\uff0c\u7ebf\u7a0b\u6c60\u4f1a\u62d2\u7edd\u5904\u7406\u4efb\u52a1\u800c\u629b\u51fa\u5f02\u5e38<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setMaxPoolSize(<span style=\"color: #d19a66;line-height: 26px;\">64<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5f53\u7ebf\u7a0b\u7a7a\u95f2\u65f6\u95f4\u8fbe\u5230keepAliveTime\u65f6\uff0c\u7ebf\u7a0b\u4f1a\u9000\u51fa\uff0c\u76f4\u5230\u7ebf\u7a0b\u6570\u91cf=corePoolSize<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5141\u8bb8\u7ebf\u7a0b\u7a7a\u95f2\u65f6\u95f430\u79d2\uff0c\u5f53maxPoolSize\u7684\u7ebf\u7a0b\u5728\u7a7a\u95f2\u65f6\u95f4\u5230\u8fbe\u7684\u65f6\u5019\u9500\u6bc1<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5982\u679callowCoreThreadTimeout=true\uff0c\u5219\u4f1a\u76f4\u5230\u7ebf\u7a0b\u6570\u91cf=0<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setKeepAliveSeconds(<span style=\"color: #d19a66;line-height: 26px;\">30<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/spring \u63d0\u4f9b\u7684 ThreadPoolTaskExecutor \u7ebf\u7a0b\u6c60\uff0c\u662f\u6709setThreadNamePrefix()&nbsp;\u65b9\u6cd5\u7684\u3002<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/jdk&nbsp;\u63d0\u4f9b\u7684ThreadPoolExecutor&nbsp;\u7ebf\u7a0b\u6c60\u662f\u6ca1\u6709&nbsp;setThreadNamePrefix()&nbsp;\u65b9\u6cd5\u7684<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setThreadNamePrefix(<span style=\"color: #98c379;line-height: 26px;\">\"\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60-\"<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/ rejection-policy\uff1a\u62d2\u7edd\u7b56\u7565\uff1a\u5f53\u7ebf\u7a0b\u6570\u5df2\u7ecf\u8fbe\u5230maxSize\u7684\u65f6\u5019\uff0c\u5982\u4f55\u5904\u7406\u65b0\u4efb\u52a1<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/ CallerRunsPolicy()\uff1a\u4ea4\u7531\u8c03\u7528\u65b9\u7ebf\u7a0b\u8fd0\u884c\uff0c\u6bd4\u5982 main \u7ebf\u7a0b\uff1b\u5982\u679c\u6dfb\u52a0\u5230\u7ebf\u7a0b\u6c60\u5931\u8d25\uff0c\u90a3\u4e48\u4e3b\u7ebf\u7a0b\u4f1a\u81ea\u5df1\u53bb\u6267\u884c\u8be5\u4efb\u52a1\uff0c\u4e0d\u4f1a\u7b49\u5f85\u7ebf\u7a0b\u6c60\u4e2d\u7684\u7ebf\u7a0b\u53bb\u6267\u884c, (\u4e2a\u4eba\u63a8\u8350)<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/ AbortPolicy()\uff1a\u8be5\u7b56\u7565\u662f\u7ebf\u7a0b\u6c60\u7684\u9ed8\u8ba4\u7b56\u7565\uff0c\u5982\u679c\u7ebf\u7a0b\u6c60\u961f\u5217\u6ee1\u4e86\u4e22\u6389\u8fd9\u4e2a\u4efb\u52a1\u5e76\u4e14\u629b\u51faRejectedExecutionException\u5f02\u5e38\u3002<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/ DiscardPolicy()\uff1a\u5982\u679c\u7ebf\u7a0b\u6c60\u961f\u5217\u6ee1\u4e86\uff0c\u4f1a\u76f4\u63a5\u4e22\u6389\u8fd9\u4e2a\u4efb\u52a1\u5e76\u4e14\u4e0d\u4f1a\u6709\u4efb\u4f55\u5f02\u5e38<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/ DiscardOldestPolicy()\uff1a\u4e22\u5f03\u961f\u5217\u4e2d\u6700\u8001\u7684\u4efb\u52a1\uff0c\u961f\u5217\u6ee1\u4e86\uff0c\u4f1a\u5c06\u6700\u65e9\u8fdb\u5165\u961f\u5217\u7684\u4efb\u52a1\u5220\u6389\u817e\u51fa\u7a7a\u95f4\uff0c\u518d\u5c1d\u8bd5\u52a0\u5165\u961f\u5217<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.setRejectedExecutionHandler(<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;ThreadPoolExecutor.CallerRunsPolicy());\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u7ebf\u7a0b\u6c60\u5173\u95ed\u7684\u65f6\u5019\u7b49\u5f85\u6240\u6709\u4efb\u52a1\u90fd\u5b8c\u6210\u518d\u7ee7\u7eed\u9500\u6bc1\u5176\u4ed6\u7684Bean\uff0c\u8fd9\u6837\u8fd9\u4e9b\u5f02\u6b65\u4efb\u52a1\u7684\u9500\u6bc1\u5c31\u4f1a\u5148\u4e8eRedis\u7ebf\u7a0b\u6c60\u7684\u9500\u6bc1<\/span>\n&nbsp;&nbsp;executor.setWaitForTasksToCompleteOnShutdown(<span style=\"color: #c678dd;line-height: 26px;\">true<\/span>);\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8bbe\u7f6e\u7ebf\u7a0b\u6c60\u4e2d\u4efb\u52a1\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u5982\u679c\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u5019\u8fd8\u6ca1\u6709\u9500\u6bc1\u5c31\u5f3a\u5236\u9500\u6bc1\uff0c\u4ee5\u786e\u4fdd\u5e94\u7528\u6700\u540e\u80fd\u591f\u88ab\u5173\u95ed\uff0c\u800c\u4e0d\u662f\u963b\u585e\u4f4f\u3002<\/span>\n&nbsp;&nbsp;executor.setAwaitTerminationSeconds(<span style=\"color: #d19a66;line-height: 26px;\">60<\/span>);\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executor.initialize();\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>&nbsp;executor;\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;\"><strong>\u5f00\u542f\u5b50\u7ebf\u7a0b\u65b9\u6cd5: &nbsp;<\/strong>\u5728\u9700\u8981\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5\u4e0a\u6dfb\u52a0 \u6ce8\u89e3<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);\">@Async(\"threadPoolTaskExecutor\")<\/code>\u5373\u53ef\uff0c\u5176\u4e2d\u6ce8\u89e3\u4e2d\u7684\u53c2\u6570\u4e3a\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\u7684\u540d\u79f0\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>\u4e8c\u3001\u81ea\u5b9a\u4e49\u6ce8\u89e3\u5b9e\u73b0\u591a\u7ebf\u7a0b\u4e8b\u52a1\u63a7\u5236<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>1.\u81ea\u5b9a\u4e49\u6ce8\u89e3<span style=\"display: none;\"><\/span><\/h5>\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;\">\u672c\u6587\u662f\u4f7f\u7528\u4e86\u4e24\u4e2a\u6ce8\u89e3\u5171\u540c\u4f5c\u7528\u5b9e\u73b0\u7684\uff0c\u4e3b\u7ebf\u7a0b\u5f53\u505a\u534f\u8c03\u8005\uff0c\u5404\u5b50\u7ebf\u7a0b\u4f5c\u4e3a\u53c2\u4e0e\u8005<\/p>\n<\/blockquote>\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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">package<\/span>&nbsp;com.example.anno;\n&nbsp;\n<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: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;*&nbsp;\u591a\u7ebf\u7a0b\u4e8b\u52a1\u6ce8\u89e3:&nbsp;\u4e3b\u4e8b\u52a1\n&nbsp;*\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@author<\/span>&nbsp;zlj\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@since<\/span>&nbsp;2022\/11\/3\n&nbsp;*\/<\/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;MainTransaction&nbsp;{\n&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><\/span>;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5b50\u7ebf\u7a0b\u6570\u91cf<\/span>\n}\n<\/code><\/pre>\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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">package<\/span>&nbsp;com.example.anno;\n&nbsp;\n<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: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;*&nbsp;\u591a\u7ebf\u7a0b\u4e8b\u52a1\u6ce8\u89e3:&nbsp;\u5b50\u4e8b\u52a1\n&nbsp;*\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@author<\/span>&nbsp;zlj\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@since<\/span>&nbsp;2022\/11\/3\n&nbsp;*\/<\/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;SonTransaction&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"line-height: 26px;\">String&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;\"\"<\/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;\"><strong>\u89e3\u91ca:<\/strong><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e24\u4e2a\u6ce8\u89e3\u90fd\u662f\u7528\u5728\u65b9\u6cd5\u4e0a\u7684\uff0c\u987b\u914d\u5408<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);\">@Transactional(rollbackFor = Exception.class)<\/code>\u4e00\u8d77\u4f7f\u7528<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\"><strong>@MainTransaction\u6ce8\u89e3<\/strong> \u7528\u5728\u8c03\u7528\u65b9\uff0c\u5176\u53c2\u6570\u4e3a\u5fc5\u586b\uff0c\u53c2\u6570\u503c\u4e3a\u672c\u65b9\u6cd5\u4e2d\u8c03\u7528\u7684\u65b9\u6cd5\u5f00\u542f\u7684\u7ebf\u7a0b\u6570\uff0c\u5982\uff1a\u5728\u8fd9\u4e2a\u65b9\u6cd5\u4e2d\u8c03\u7528\u7684\u65b9\u6cd5\u4e2d\u67092\u4e2a\u65b9\u6cd5\u7528<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);\">@Async<\/code>\u6ce8\u89e3\u5f00\u542f\u4e86\u5b50\u7ebf\u7a0b\uff0c\u5219\u53c2\u6570\u4e3a<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);\">@MainTransaction(2)<\/code>\uff0c\u53e6\u5916\u5982\u679c\u672a\u4f7f\u7528<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);\">@MainTransaction<\/code>\u6ce8\u89e3\uff0c\u5219\u76f4\u63a5\u5df2\u65e0\u591a\u7ebf\u7a0b\u4e8b\u52a1\u6267\u884c(\u4e0d\u5f71\u54cd\u65b9\u6cd5\u7684\u5355\u7ebf\u7a0b\u4e8b\u52a1)<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\"><strong>@SonTransaction\u6ce8\u89e3<\/strong> \u7528\u5728\u88ab\u8c03\u7528\u65b9(\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5)\uff0c\u65e0\u9700\u4f20\u5165\u53c2\u6570<\/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.AOP\u5185\u5bb9<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;\">\u4ee3\u7801\u5982\u4e0b\uff1a<\/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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">package<\/span>&nbsp;com.example.aop;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.baomidou.mybatisplus.core.toolkit.CollectionUtils;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.example.anno.MainTransaction;\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.springframework.stereotype.Component;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.PlatformTransactionManager;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.TransactionDefinition;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.TransactionStatus;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.support.DefaultTransactionDefinition;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.annotation.Resource;\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<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.Vector;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.concurrent.CountDownLatch;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;java.util.concurrent.atomic.AtomicBoolean;\n&nbsp;\n<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;*&nbsp;\u591a\u7ebf\u7a0b\u4e8b\u52a1\n&nbsp;*\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@author<\/span>&nbsp;zlj\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@since<\/span>&nbsp;2022\/11\/3\n&nbsp;*\/<\/span>\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;\">TransactionAop<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u7528\u6765\u5b58\u50a8\u5404\u7ebf\u7a0b\u8ba1\u6570\u5668\u6570\u636e(\u6bcf\u6b21\u6267\u884c\u540e\u4f1a\u4ecemap\u4e2d\u5220\u9664)<\/span>\n&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;Map&lt;String,&nbsp;Object&gt;&nbsp;map&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;HashMap&lt;&gt;();\n&nbsp;\n&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Resource<\/span>\n&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;PlatformTransactionManager&nbsp;transactionManager;\n&nbsp;\n&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(mainTransaction)\"<\/span>)\n&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;\">mainIntercept<\/span><span style=\"line-height: 26px;\">(ProceedingJoinPoint&nbsp;joinPoint,&nbsp;MainTransaction&nbsp;mainTransaction)<\/span>&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throws<\/span>&nbsp;Throwable&nbsp;<\/span>{\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5f53\u524d\u7ebf\u7a0b\u540d\u79f0<\/span>\n&nbsp;&nbsp;Thread&nbsp;thread&nbsp;=&nbsp;Thread.currentThread();\n&nbsp;&nbsp;String&nbsp;threadName&nbsp;=&nbsp;thread.getName();\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u521d\u59cb\u5316\u8ba1\u6570\u5668<\/span>\n&nbsp;&nbsp;CountDownLatch&nbsp;mainDownLatch&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;CountDownLatch(<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>);\n&nbsp;&nbsp;CountDownLatch&nbsp;sonDownLatch&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;CountDownLatch(mainTransaction.value());<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/@MainTransaction\u6ce8\u89e3\u4e2d\u7684\u53c2\u6570,&nbsp;\u4e3a\u5b50\u7ebf\u7a0b\u7684\u6570\u91cf<\/span>\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u7528\u6765\u8bb0\u5f55\u5b50\u7ebf\u7a0b\u7684\u8fd0\u884c\u72b6\u6001\uff0c\u53ea\u8981\u6709\u4e00\u4e2a\u5931\u8d25\u5c31\u53d8\u4e3atrue<\/span>\n&nbsp;&nbsp;AtomicBoolean&nbsp;rollBackFlag&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;AtomicBoolean(<span style=\"color: #c678dd;line-height: 26px;\">false<\/span>);\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u7528\u6765\u5b58\u6bcf\u4e2a\u5b50\u7ebf\u7a0b\u7684\u5f02\u5e38\uff0c\u628a\u6bcf\u4e2a\u7ebf\u7a0b\u7684\u81ea\u5b9a\u4e49\u5f02\u5e38\u5411vector\u7684\u9996\u4f4d\u7f6e\u63d2\u5165\uff0c\u5176\u4f59\u5f02\u5e38\u5411\u672b\u4f4d\u7f6e\u63d2\u5165\uff0c\u907f\u514d\u7ebf\u7a0b\u4e0d\u5b89\u5168\uff0c\u6240\u4ee5\u4f7f\u7528vector\u4ee3\u66fflist<\/span>\n&nbsp;&nbsp;Vector&lt;Throwable&gt;&nbsp;exceptionVector&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;Vector&lt;&gt;();\n&nbsp;\n&nbsp;&nbsp;map.put(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"mainDownLatch\"<\/span>,&nbsp;mainDownLatch);\n&nbsp;&nbsp;map.put(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"sonDownLatch\"<\/span>,&nbsp;sonDownLatch);\n&nbsp;&nbsp;map.put(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"rollBackFlag\"<\/span>,&nbsp;rollBackFlag);\n&nbsp;&nbsp;map.put(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"exceptionVector\"<\/span>,&nbsp;exceptionVector);\n&nbsp;\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;joinPoint.proceed();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u6267\u884c\u65b9\u6cd5<\/span>\n&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Throwable&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;exceptionVector.add(<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>,&nbsp;e);\n&nbsp;&nbsp;&nbsp;rollBackFlag.set(<span style=\"color: #c678dd;line-height: 26px;\">true<\/span>);<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5b50\u7ebf\u7a0b\u56de\u6eda<\/span>\n&nbsp;&nbsp;&nbsp;mainDownLatch.countDown();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u653e\u884c\u6240\u6709\u5b50\u7ebf\u7a0b<\/span>\n&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(!rollBackFlag.get())&nbsp;{\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;sonDownLatch\u7b49\u5f85\uff0c\u76f4\u5230\u6240\u6709\u5b50\u7ebf\u7a0b\u6267\u884c\u5b8c\u63d2\u5165\u64cd\u4f5c\uff0c\u4f46\u6b64\u65f6\u8fd8\u6ca1\u6709\u63d0\u4ea4\u4e8b\u52a1<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;sonDownLatch.await();\n&nbsp;&nbsp;&nbsp;&nbsp;mainDownLatch.countDown();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u6839\u636erollBackFlag\u72b6\u6001\u653e\u884c\u5b50\u7ebf\u7a0b\u7684await\u5904\uff0c\u544a\u77e5\u662f\u56de\u6eda\u8fd8\u662f\u63d0\u4ea4<\/span>\n&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;rollBackFlag.set(<span style=\"color: #c678dd;line-height: 26px;\">true<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;exceptionVector.add(<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>,&nbsp;e);\n&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;}\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(CollectionUtils.isNotEmpty(exceptionVector))&nbsp;{\n&nbsp;&nbsp;&nbsp;map.remove(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"mainDownLatch\"<\/span>);\n&nbsp;&nbsp;&nbsp;map.remove(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"sonDownLatch\"<\/span>);\n&nbsp;&nbsp;&nbsp;map.remove(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"rollBackFlag\"<\/span>);\n&nbsp;&nbsp;&nbsp;map.remove(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"exceptionVector\"<\/span>);\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">throw<\/span>&nbsp;exceptionVector.get(<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>);\n&nbsp;&nbsp;}\n&nbsp;}\n&nbsp;\n&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Around<\/span>(<span style=\"color: #98c379;line-height: 26px;\">\"@annotation(com.huigu.common.anno.SonTransaction)\"<\/span>)\n&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;\">sonIntercept<\/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;Object[]&nbsp;args&nbsp;=&nbsp;joinPoint.getArgs();\n&nbsp;&nbsp;Thread&nbsp;thread&nbsp;=&nbsp;(Thread)&nbsp;args[args.length&nbsp;-&nbsp;<span style=\"color: #d19a66;line-height: 26px;\">1<\/span>];\n&nbsp;&nbsp;String&nbsp;threadName&nbsp;=&nbsp;thread.getName();\n&nbsp;&nbsp;CountDownLatch&nbsp;mainDownLatch&nbsp;=&nbsp;(CountDownLatch)&nbsp;map.get(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"mainDownLatch\"<\/span>);\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(mainDownLatch&nbsp;==&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">null<\/span>)&nbsp;{\n&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u4e3b\u4e8b\u52a1\u672a\u52a0\u6ce8\u89e3\u65f6,&nbsp;\u76f4\u63a5\u6267\u884c\u5b50\u4e8b\u52a1<\/span>\n&nbsp;&nbsp;&nbsp;joinPoint.proceed();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8fd9\u91cc\u6700\u597d\u7684\u65b9\u5f0f\u662f:\u4ea4\u7531\u4e0a\u9762\u7684thread\u6765\u8c03\u7528\u6b64\u65b9\u6cd5,\u4f46\u6211\u6ca1\u6709\u627e\u5bfb\u5230\u5bf9\u5e94api,\u53ea\u80fd\u76f4\u63a5\u653e\u5f03\u4e8b\u52a1,&nbsp;\u6b22\u8fce\u5927\u795e\u6765\u4f18\u5316,&nbsp;\u7559\u8a00\u5206\u4eab<\/span>\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>;\n&nbsp;&nbsp;}\n&nbsp;&nbsp;CountDownLatch&nbsp;sonDownLatch&nbsp;=&nbsp;(CountDownLatch)&nbsp;map.get(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"sonDownLatch\"<\/span>);\n&nbsp;&nbsp;AtomicBoolean&nbsp;rollBackFlag&nbsp;=&nbsp;(AtomicBoolean)&nbsp;map.get(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"rollBackFlag\"<\/span>);\n&nbsp;&nbsp;Vector&lt;Throwable&gt;&nbsp;exceptionVector&nbsp;=&nbsp;(Vector&lt;Throwable&gt;)&nbsp;map.get(threadName&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"exceptionVector\"<\/span>);\n&nbsp;\n&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u5982\u679c\u8fd9\u65f6\u6709\u4e00\u4e2a\u5b50\u7ebf\u7a0b\u5df2\u7ecf\u51fa\u9519\uff0c\u90a3\u5f53\u524d\u7ebf\u7a0b\u4e0d\u9700\u8981\u6267\u884c<\/span>\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(rollBackFlag.get())&nbsp;{\n&nbsp;&nbsp;&nbsp;sonDownLatch.countDown();\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">return<\/span>;\n&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;DefaultTransactionDefinition&nbsp;def&nbsp;=&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">new<\/span>&nbsp;DefaultTransactionDefinition();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5f00\u542f\u4e8b\u52a1<\/span>\n&nbsp;&nbsp;def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u8bbe\u7f6e\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b<\/span>\n&nbsp;&nbsp;TransactionStatus&nbsp;status&nbsp;=&nbsp;transactionManager.getTransaction(def);\n&nbsp;\n&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">try<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;joinPoint.proceed();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u6267\u884c\u65b9\u6cd5<\/span>\n&nbsp;\n&nbsp;&nbsp;&nbsp;sonDownLatch.countDown();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5bf9sonDownLatch-1<\/span>\n&nbsp;&nbsp;&nbsp;mainDownLatch.await();<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5982\u679cmainDownLatch\u4e0d\u662f0\uff0c\u7ebf\u7a0b\u4f1a\u5728\u6b64\u963b\u585e\uff0c\u76f4\u5230mainDownLatch\u53d8\u4e3a0<\/span>\n&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5982\u679c\u80fd\u6267\u884c\u5230\u8fd9\u4e00\u6b65\u8bf4\u660e\u6240\u6709\u5b50\u7ebf\u7a0b\u90fd\u5df2\u7ecf\u6267\u884c\u5b8c\u6bd5\u5224\u65ad\u5982\u679catomicBoolean\u662ftrue\u5c31\u56de\u6edafalse\u5c31\u63d0\u4ea4<\/span>\n&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">if<\/span>&nbsp;(rollBackFlag.get())&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;transactionManager.rollback(status);\n&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">else<\/span>&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;transactionManager.commit(status);\n&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;}&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">catch<\/span>&nbsp;(Throwable&nbsp;e)&nbsp;{\n&nbsp;&nbsp;&nbsp;exceptionVector.add(<span style=\"color: #d19a66;line-height: 26px;\">0<\/span>,&nbsp;e);\n&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u56de\u6eda<\/span>\n&nbsp;&nbsp;&nbsp;transactionManager.rollback(status);\n&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5e76\u628a\u72b6\u6001\u8bbe\u7f6e\u4e3atrue<\/span>\n&nbsp;&nbsp;&nbsp;rollBackFlag.set(<span style=\"color: #c678dd;line-height: 26px;\">true<\/span>);\n&nbsp;&nbsp;&nbsp;mainDownLatch.countDown();\n&nbsp;&nbsp;&nbsp;sonDownLatch.countDown();\n&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;\"><strong>\u6269\u5c55\u8bf4\u660e: CountDownLatch\u662f\u4ec0\u4e48?<\/strong><\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u4e00\u4e2a\u540c\u6b65\u8f85\u52a9\u7c7b<\/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;\">\u521b\u5efa\u5bf9\u8c61\u65f6: \u7528\u7ed9\u5b9a\u7684\u6570\u5b57\u521d\u59cb\u5316 <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);\">CountDownLatch<\/code><\/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;\"><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);\">countDown()<\/code> \u65b9\u6cd5: \u4f7f\u8ba1\u6570\u51cf1<\/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;\"><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);\">await()<\/code> \u65b9\u6cd5: \u963b\u585e\u5f53\u524d\u7ebf\u7a0b, \u76f4\u81f3\u5f53\u524d\u8ba1\u6570\u5230\u8fbe\u96f6\u3002<\/p>\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;\">\u672c\u6587\u4e2d:<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u7528 \u8ba1\u6570 1 \u521d\u59cb\u5316\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);\">mainDownLatch<\/code> \u5f53\u4f5c\u4e00\u4e2a\u7b80\u5355\u7684\u5f00\/\u5173\u9501\u5b58\u5668\uff0c\u6216\u5165\u53e3\uff1a\u5728\u901a\u8fc7\u8c03\u7528 <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);\">countDown()<\/code> \u7684\u7ebf\u7a0b\u6253\u5f00\u5165\u53e3\u524d\uff0c\u6240\u6709\u8c03\u7528 await \u7684\u7ebf\u7a0b\u90fd\u4e00\u76f4\u5728\u5165\u53e3\u5904\u7b49\u5f85\u3002<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;\">\u7528 \u5b50\u7ebf\u7a0b\u6570\u91cf \u521d\u59cb\u5316\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);\">sonDownLatch<\/code> \u53ef\u4ee5\u4f7f\u4e00\u4e2a\u7ebf\u7a0b\u5728 N \u4e2a\u7ebf\u7a0b\u5b8c\u6210\u67d0\u9879\u64cd\u4f5c\u4e4b\u524d\u4e00\u76f4\u7b49\u5f85\uff0c\u6216\u8005\u4f7f\u5176\u5728\u67d0\u9879\u64cd\u4f5c\u5b8c\u6210 N \u6b21\u4e4b\u524d\u4e00\u76f4\u7b49\u5f85\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>3\u3001\u6ce8\u89e3\u4f7f\u7528Demo<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;\">\u4efb\u52a1\u65b9\u6cd5:<\/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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">package<\/span>&nbsp;com.example.demo.service;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.example.demo.anno.SonTransaction;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.scheduling.annotation.Async;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Service;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.annotation.Transactional;\n&nbsp;\n<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@author<\/span>&nbsp;zlj\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@since<\/span>&nbsp;2022\/11\/14\n&nbsp;*\/<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Service<\/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;\">SonService<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u53c2\u6570\u8bf4\u660e:&nbsp;&nbsp;\u4ee5\u4e0b4\u4e2a\u65b9\u6cd5\u53c2\u6570\u548c\u6b64\u76f8\u540c\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@param<\/span>&nbsp;args&nbsp;&nbsp;&nbsp;\u4e1a\u52a1\u4e2d\u9700\u8981\u4f20\u9012\u7684\u53c2\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@param<\/span>&nbsp;thread&nbsp;\u8c03\u7528\u8005\u7684\u7ebf\u7a0b,&nbsp;\u7528\u4e8eaop\u83b7\u53d6\u53c2\u6570,&nbsp;\u4e0d\u5efa\u8bae\u4ee5\u65b9\u6cd5\u91cd\u5199\u7684\u65b9\u5f0f\u7b80\u7565\u6b64\u53c2\u6570,\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5728\u8c03\u7528\u8005\u65b9\u6cd5\u4e2d\u53ef\u4ee5\u4ee5\u6b64\u53c2\u6570\u4e3a\u6807\u8bc6\u8ba1\u7b97\u5b50\u7ebf\u7a0b\u7684\u4e2a\u6570\u4f5c\u4e3a\u6ce8\u89e3\u53c2\u6570,\u907f\u514d\u7ebf\u7a0b\u53c2\u6570\u8ba1\u7b97\u9519\u8bef\u5bfc\u81f4\u9501\u8868\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4f20\u53c2\u65f6\u53c2\u6570\u56fa\u5b9a\u4e3a:&nbsp;Thread.currentThread()\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">Async<\/span>(\"<span style=\"color: #e6c07b;line-height: 26px;\">threadPoolTaskExecutor<\/span>\")\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">SonTransaction<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">sonMethod1<\/span>(<span style=\"color: #e6c07b;line-height: 26px;\">String<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">args<\/span>,&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">Thread<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">thread<\/span>)&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(args&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">Async<\/span>(\"<span style=\"color: #e6c07b;line-height: 26px;\">threadPoolTaskExecutor<\/span>\")\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">SonTransaction<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">sonMethod2<\/span>(<span style=\"color: #e6c07b;line-height: 26px;\">String<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">args1<\/span>,&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">String<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">args2<\/span>,&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">Thread<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">thread<\/span>)&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(args1&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u548c\"<\/span>&nbsp;+&nbsp;args2&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">Async<\/span>(\"<span style=\"color: #e6c07b;line-height: 26px;\">threadPoolTaskExecutor<\/span>\")\n&nbsp;&nbsp;&nbsp;&nbsp;@<span style=\"color: #e6c07b;line-height: 26px;\">SonTransaction<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">sonMethod3<\/span>(<span style=\"color: #e6c07b;line-height: 26px;\">String<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">args<\/span>,&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">Thread<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">thread<\/span>)&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(args&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/sonMethod4\u65b9\u6cd5\u6ca1\u6709\u4f7f\u7528\u7ebf\u7a0b\u6c60<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">sonMethod4<\/span>(<span style=\"color: #e6c07b;line-height: 26px;\">String<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">args<\/span>)&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(args&nbsp;+&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u6ca1\u6709\u5f00\u542f\u7ebf\u7a0b\"<\/span>);\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;\">\u8c03\u7528\u65b9:<\/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\/wJibWkqN1bUMGV1UTPd8FdqRkJmtqlTNEhFRvhx5u0VhL9FxnOVaLajKXVHzC3mxZOxxKX8D0mOiaKH05ELAGROEda4EM1Gt9c\/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;\">package<\/span>&nbsp;com.example.demo.service;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;com.example.demo.anno.MainTransaction;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.stereotype.Service;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;org.springframework.transaction.annotation.Transactional;\n&nbsp;\n<span style=\"color: #c678dd;line-height: 26px;\">import<\/span>&nbsp;javax.annotation.Resource;\n&nbsp;\n<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/**\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@author<\/span>&nbsp;zlj\n&nbsp;*&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">@since<\/span>&nbsp;2022\/11\/14\n&nbsp;*\/<\/span>\n<span style=\"color: #61aeee;line-height: 26px;\">@Service<\/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;\">MainService<\/span>&nbsp;<\/span>{\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Resource<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #c678dd;line-height: 26px;\">private<\/span>&nbsp;SonService&nbsp;sonService;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@MainTransaction<\/span>(<span style=\"color: #d19a66;line-height: 26px;\">3<\/span>)<span style=\"color: #5c6370;font-style: italic;line-height: 26px;\">\/\/\u8c03\u7528\u7684\u65b9\u6cd5\u4e2dsonMethod1\/sonMethod2\/sonMethod3\u4f7f\u7528@Async\u5f00\u542f\u4e86\u7ebf\u7a0b,&nbsp;\u6240\u4ee5\u53c2\u6570\u4e3a:&nbsp;3<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">test1<\/span>()&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod1(<span style=\"color: #98c379;line-height: 26px;\">\"\u8def\u98de\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod2(<span style=\"color: #98c379;line-height: 26px;\">\"\u7d22\u9686\"<\/span>,&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u5c71\u6cbb\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod3(<span style=\"color: #98c379;line-height: 26px;\">\"\u5a1c\u7f8e\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod4(<span style=\"color: #98c379;line-height: 26px;\">\"\u7f57\u5bbe\"<\/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;\u6709\u7684\u4e1a\u52a1\u4e2d\u5b58\u5728if\u7684\u591a\u79cd\u53ef\u80fd,&nbsp;\u6bcf\u4e00\u79cd\u8d70\u5411\u8c03\u7528\u7684\u65b9\u6cd5(\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5)\u6570\u91cf\u5982\u679c\u4e0d\u540c,&nbsp;\u8fd9\u65f6\u53ef\u4ee5\u9009\u62e9\u653e\u5f03\u4f7f\u7528@MainTransaction\u6ce8\u89e3\u907f\u514d\u9501\u8868\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u8fd9\u65f6\u5019\u5982\u679c\u53d1\u751f\u5f02\u5e38\u4f1a\u5bfc\u81f4\u591a\u7ebf\u7a0b\u4e0d\u80fd\u540c\u65f6\u56de\u6eda,&nbsp;\u53ef\u6839\u636e\u4e1a\u52a1\u81ea\u5df1\u6743\u8861\u662f\u5426\u4f7f\u7528\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span>\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #61aeee;line-height: 26px;\">@Transactional<\/span>(rollbackFor&nbsp;=&nbsp;Exception<span style=\"line-height: 26px;\">.<span style=\"color: #c678dd;line-height: 26px;\">class<\/span>)\n&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">public<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">void<\/span>&nbsp;<span style=\"color: #e6c07b;line-height: 26px;\">test2<\/span>()&nbsp;<\/span>{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod1(<span style=\"color: #98c379;line-height: 26px;\">\"\u8def\u98de\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod2(<span style=\"color: #98c379;line-height: 26px;\">\"\u7d22\u9686\"<\/span>,&nbsp;<span style=\"color: #98c379;line-height: 26px;\">\"\u5c71\u6cbb\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod3(<span style=\"color: #98c379;line-height: 26px;\">\"\u5a1c\u7f8e\"<\/span>,&nbsp;Thread.currentThread());\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sonService.sonMethod4(<span style=\"color: #98c379;line-height: 26px;\">\"\u7f57\u5bbe\"<\/span>);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n}\n<\/code><\/pre>\n<\/section>\n<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"margin-bottom: 0px;padding-right: 10px;padding-left: 10px;outline: 0px;white-space: normal;color: black;font-size: 16px;letter-spacing: 0px;text-align: left;background-color: rgb(255, 255, 255);line-height: 1.6;word-break: break-word;font-family: PingFangSC-Light;\">\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"outline: 0px;font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-align: right;\"><\/h3>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"outline: 0px;font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-align: right;\"><em style=\"outline: 0px;color: rgb(136, 136, 136);font-size: 12px;letter-spacing: 0.5px;\">\u6765\u6e90\uff1ablog.csdn.net\/weixin_69672118\/<\/em><\/h3>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"outline: 0px;font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-align: right;\"><em style=\"outline: 0px;color: rgb(136, 136, 136);font-size: 12px;letter-spacing: 0.5px;\">article\/details\/127675808<\/em><\/h3>\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\/XBKCp0iyIUWN-Jg8HrWweA<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u6211\u4eec\u5f00\u53d1\u7684\u65f6\u5019\u5e38\u5e38\u4f1a\u9047\u5230\u591a\u7ebf\u7a0b\u4e8b\u52a1\u7684\u95ee\u9898\u3002\u4ee5\u4e3a\u6dfb\u52a0\u4e86@Transactional\u6ce8\u89e3\u5c31\u884c\u4e86\uff0c\u5176\u5b9e\u4f60\u52a0\u4e86\u6ce8\u89e3\u4e4b\u540e\u4f1a\u53d1\u73b0\u4e8b\u52a1\u5931\u6548 &#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-2937","post","type-post","status-publish","format-standard","hentry","category-spring","category-spring-boot","category-spring-cloud"],"post_thumbnail_image":"","content_first_image":null,"post_medium_image_300":"","post_thumbnail_image_624":"","post_frist_image":null,"post_medium_image":"","post_large_image":"","post_full_image":"","post_all_images":[],"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":501,"next_post_id":2941,"next_post_title":"Mybatis\u7cfb\u5217\u7b2c12\u7bc7\uff1a\u638c\u63e1\u7f13\u5b58\u4e3a\u67e5\u8be2\u63d0\u901f!","previous_post_id":2933,"previous_post_title":"Spring \u8d4c\u4e0a\u672a\u6765\u7684\u4e00\u51fb\uff0c\u54cd\u5e94\u5f0f\u7684 WebFlux \u6846\u67b6\u66f4\u4f18\u96c5\uff0c\u6027\u80fd\u66f4\u5f3a\uff01","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2937","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=2937"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2937\/revisions"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}