{"id":3095,"date":"2023-08-31T09:30:15","date_gmt":"2023-08-31T01:30:15","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=3095"},"modified":"2023-08-31T09:30:29","modified_gmt":"2023-08-31T01:30:29","slug":"spring-boot-%e5%a4%9a%e7%ba%bf%e7%a8%8b%e4%ba%8b%e5%8a%a1%e5%9b%9e%e6%bb%9a%ef%bc%8c%e4%b8%80%e4%b8%aa%e6%b3%a8%e8%a7%a3%e8%bd%bb%e6%9d%be%e6%90%9e%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-boot-%e5%a4%9a%e7%ba%bf%e7%a8%8b%e4%ba%8b%e5%8a%a1%e5%9b%9e%e6%bb%9a%ef%bc%8c%e4%b8%80%e4%b8%aa%e6%b3%a8%e8%a7%a3%e8%bd%bb%e6%9d%be%e6%90%9e%e5%ae%9a\/","title":{"rendered":"Spring Boot \u591a\u7ebf\u7a0b\u4e8b\u52a1\u56de\u6eda\uff0c\u4e00\u4e2a\u6ce8\u89e3\u8f7b\u677e\u641e\u5b9a"},"content":{"rendered":"<figure style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; display: flex; flex-direction: column; justify-content: center; align-items: center; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><\/figure>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\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=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; visibility: visible;\">@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 style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\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 style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u672c\u6587\u662f\u57fa\u4e8espringboot\u7684<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; visibility: visible;\">@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 \u00a0(CV\u5373\u7528\u3001\u53c2\u6570\u9f50\u5168\u3001\u65e0\u9700\u914d\u7f6e)<\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff1aSpringForAll\u793e\u533a\uff08spring4all.com\uff09\uff0c\u4e13\u6ce8\u5206\u4eab\u5173\u4e8eSpring\u7684\u4e00\u5207\uff01\u56de\u590d\u201c\u52a0\u7fa4\u201d\u8fd8\u53ef\u52a0\u5165Spring\u6280\u672f\u4ea4\u6d41\u7fa4\uff01<\/p>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; outline: 0px; font-weight: bold; font-size: 22px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"padding: 2px 4px; outline: 0px; display: inline-block; counter-increment: counterh2 1; color: #9fcdd0; border-bottom: 4px solid #9fcdd0; font-size: 18px; visibility: visible;\">\u4e00<\/span><span style=\"padding: 2px 4px; outline: 0px; font-size: 18px; border-bottom: 4px solid #2584b5; color: #2584b5; visibility: visible;\">\u3001springboot\u591a\u7ebf\u7a0b(\u58f0\u660e\u5f0f)\u7684\u4f7f\u7528\u65b9\u6cd5\uff1f<\/span><\/h2>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">1\u3001springboot\u63d0\u4f9b\u4e86\u6ce8\u89e3<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; visibility: visible;\">@Async<\/code>\u6765\u4f7f\u7528\u7ebf\u7a0b\u6c60\uff0c\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">(1) \u5728\u542f\u52a8\u7c7b(\u914d\u7f6e\u7c7b)\u6dfb\u52a0<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; visibility: visible;\">@EnableAsync<\/code>\u6765\u5f00\u542f\u7ebf\u7a0b\u6c60<\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">(2) \u5728\u9700\u8981\u5f00\u542f\u5b50\u7ebf\u7a0b\u7684\u65b9\u6cd5\u4e0a\u6dfb\u52a0\u6ce8\u89e3<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; visibility: visible;\">@Async<\/code><\/p>\n<blockquote style=\"margin-top: 20px; margin-bottom: 20px; padding: 10px 10px 10px 20px; outline: 0px; color: #6a737d; font-size: 0.9em; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background: #ffffff; overflow: auto; visibility: visible; border: 1px dashed #2584b5;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; outline: 0px; font-size: 16px; color: black; line-height: 26px; visibility: visible;\">\u6ce8\u610f: \u6846\u67b6\u9ed8\u8ba4 -----&gt; \u00a0\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 style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6240\u4ee5\u4f7f\u7528\u65f6\u9700\u8981\u914d\u7f6e\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\uff0c\u5982\u4e0b:<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px; visibility: visible;\"><span style=\"outline: 0px; color: #4078f2; line-height: 26px; visibility: visible;\">@Configuration<\/span><br style=\"outline: 0px; visibility: visible;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px; visibility: visible;\">@EnableAsync<\/span><br style=\"outline: 0px; visibility: visible;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px; visibility: visible;\">public<\/span>\u00a0<span style=\"outline: 0px; line-height: 26px; visibility: visible;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px; visibility: visible;\">class<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px; visibility: visible;\">ThreadPoolTaskConfig<\/span>\u00a0<\/span>{<br style=\"outline: 0px; visibility: visible;\" \/>\u00a0<br style=\"outline: 0px; visibility: visible;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px; visibility: visible;\">@Bean<\/span>(<span style=\"outline: 0px; color: #50a14f; line-height: 26px; visibility: visible;\">\"threadPoolTaskExecutor\"<\/span>)<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px; visibility: visible;\">\/\/\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\u540d\u79f0<\/span><br style=\"outline: 0px; visibility: visible;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; line-height: 26px; visibility: visible;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px; visibility: visible;\">public<\/span>\u00a0ThreadPoolTaskExecutor\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px; visibility: visible;\">threadPoolTaskExecutor<\/span><span style=\"outline: 0px; line-height: 26px; visibility: visible;\">()<\/span>\u00a0<\/span>{<br style=\"outline: 0px; visibility: visible;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ThreadPoolTaskExecutor\u00a0executor\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0ThreadPoolTaskExecutor();<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setCorePoolSize(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">16<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/executor.setAllowCoreThreadTimeOut(true);<\/span><br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u963b\u585e\u961f\u5217\u00a0\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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setQueueCapacity(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">124<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u4efb\u52a1\u961f\u5217\u5df2\u6ee1\u65f6,\u00a0\u4e14\u5f53\u7ebf\u7a0b\u6570=maxPoolSize\uff0c\uff0c\u7ebf\u7a0b\u6c60\u4f1a\u62d2\u7edd\u5904\u7406\u4efb\u52a1\u800c\u629b\u51fa\u5f02\u5e38<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setMaxPoolSize(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">64<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u5982\u679callowCoreThreadTimeout=true\uff0c\u5219\u4f1a\u76f4\u5230\u7ebf\u7a0b\u6570\u91cf=0<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setKeepAliveSeconds(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">30<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/spring \u63d0\u4f9b\u7684 ThreadPoolTaskExecutor \u7ebf\u7a0b\u6c60\uff0c\u662f\u6709setThreadNamePrefix()\u00a0\u65b9\u6cd5\u7684\u3002<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/jdk\u00a0\u63d0\u4f9b\u7684ThreadPoolExecutor\u00a0\u7ebf\u7a0b\u6c60\u662f\u6ca1\u6709\u00a0setThreadNamePrefix()\u00a0\u65b9\u6cd5\u7684<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setThreadNamePrefix(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60-\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.setRejectedExecutionHandler(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0ThreadPoolExecutor.CallerRunsPolicy());<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0executor.setWaitForTasksToCompleteOnShutdown(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">true<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0executor.setAwaitTerminationSeconds(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">60<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executor.initialize();<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">return<\/span>\u00a0executor;<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong style=\"outline: 0px; color: #2584b5;\">\u5f00\u542f\u5b50\u7ebf\u7a0b\u65b9\u6cd5:<\/strong>\u00a0\u00a0\u5728\u9700\u8981\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5\u4e0a\u6dfb\u52a0 \u6ce8\u89e3<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">@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<h2 style=\"margin-top: 30px; margin-bottom: 15px; outline: 0px; font-weight: bold; font-size: 22px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"padding: 2px 4px; outline: 0px; display: inline-block; counter-increment: counterh2 1; color: #9fcdd0; border-bottom: 4px solid #9fcdd0; font-size: 18px;\">\u4e8c<\/span><span style=\"padding: 2px 4px; outline: 0px; font-size: 18px; border-bottom: 4px solid #2584b5; color: #2584b5;\">\u3001\u81ea\u5b9a\u4e49\u6ce8\u89e3\u5b9e\u73b0\u591a\u7ebf\u7a0b\u4e8b\u52a1\u63a7\u5236<\/span><\/h2>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; outline: 0px; font-weight: bold; font-size: 20px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"padding: 2px 10px; outline: 0px; font-size: 16px; border-bottom: 1px solid #2584b5; color: #2584b5;\">\u81ea\u5b9a\u4e49\u6ce8\u89e3<\/span><\/h3>\n<blockquote style=\"margin-top: 20px; margin-bottom: 20px; padding: 10px 10px 10px 20px; outline: 0px; color: #6a737d; font-size: 0.9em; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background: #ffffff; overflow: auto; border: 1px dashed #2584b5;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; outline: 0px; font-size: 16px; 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 style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">package<\/span>\u00a0com.example.anno;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.ElementType;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.Retention;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.RetentionPolicy;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.Target;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0*\u00a0\u591a\u7ebf\u7a0b\u4e8b\u52a1\u6ce8\u89e3:\u00a0\u4e3b\u4e8b\u52a1<br style=\"outline: 0px;\" \/>\u00a0*\/<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Target<\/span>({ElementType.METHOD})<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@interface<\/span>\u00a0MainTransaction\u00a0{<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">int<\/span>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">value<\/span><span style=\"outline: 0px; line-height: 26px;\">()<\/span><\/span>;<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u5b50\u7ebf\u7a0b\u6570\u91cf<\/span><br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">package<\/span>\u00a0com.example.anno;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.ElementType;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.Retention;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.RetentionPolicy;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.lang.annotation.Target;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0*\u00a0\u591a\u7ebf\u7a0b\u4e8b\u52a1\u6ce8\u89e3:\u00a0\u5b50\u4e8b\u52a1<br style=\"outline: 0px;\" \/>\u00a0*\/<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Target<\/span>({ElementType.METHOD})<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@interface<\/span>\u00a0SonTransaction\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; line-height: 26px;\">String\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">value<\/span><span style=\"outline: 0px; line-height: 26px;\">()<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">default<\/span>\u00a0\"\"<\/span>;<br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong style=\"outline: 0px; color: #2584b5;\">\u89e3\u91ca:<\/strong><\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4e24\u4e2a\u6ce8\u89e3\u90fd\u662f\u7528\u5728\u65b9\u6cd5\u4e0a\u7684\uff0c\u987b\u914d\u5408<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">@Transactional(rollbackFor = Exception.class)<\/code>\u4e00\u8d77\u4f7f\u7528<\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong style=\"outline: 0px; color: #2584b5;\">@MainTransaction\u6ce8\u89e3<\/strong>\u00a0\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=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">@Async<\/code>\u6ce8\u89e3\u5f00\u542f\u4e86\u5b50\u7ebf\u7a0b\uff0c\u5219\u53c2\u6570\u4e3a<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">@MainTransaction(2)<\/code>\uff0c\u53e6\u5916\u5982\u679c\u672a\u4f7f\u7528<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">@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 style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong style=\"outline: 0px; color: #2584b5;\">@SonTransaction\u6ce8\u89e3<\/strong>\u00a0\u7528\u5728\u88ab\u8c03\u7528\u65b9(\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5)\uff0c\u65e0\u9700\u4f20\u5165\u53c2\u6570<\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; outline: 0px; font-weight: bold; font-size: 20px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"padding: 2px 10px; outline: 0px; font-size: 16px; border-bottom: 1px solid #2584b5; color: #2584b5;\">AOP\u5185\u5bb9<\/span><\/h3>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">package<\/span>\u00a0com.example.aop;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0com.baomidou.mybatisplus.core.toolkit.CollectionUtils;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0com.example.anno.MainTransaction;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.aspectj.lang.ProceedingJoinPoint;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.aspectj.lang.annotation.Around;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.aspectj.lang.annotation.Aspect;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.stereotype.Component;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.PlatformTransactionManager;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.TransactionDefinition;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.TransactionStatus;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.support.DefaultTransactionDefinition;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0javax.annotation.Resource;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.util.HashMap;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.util.Map;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.util.Vector;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.util.concurrent.CountDownLatch;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0java.util.concurrent.atomic.AtomicBoolean;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0*\u00a0\u591a\u7ebf\u7a0b\u4e8b\u52a1<br style=\"outline: 0px;\" \/>\u00a0*\/<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Aspect<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Component<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">TransactionAop<\/span>\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">private<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">static<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">final<\/span>\u00a0Map&lt;String,\u00a0Object&gt;\u00a0map\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0HashMap&lt;&gt;();<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Resource<\/span><br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">private<\/span>\u00a0PlatformTransactionManager\u00a0transactionManager;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Around<\/span>(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"@annotation(mainTransaction)\"<\/span>)<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">mainIntercept<\/span><span style=\"outline: 0px; line-height: 26px;\">(ProceedingJoinPoint\u00a0joinPoint,\u00a0MainTransaction\u00a0mainTransaction)<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">throws<\/span>\u00a0Throwable\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u5f53\u524d\u7ebf\u7a0b\u540d\u79f0<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0Thread\u00a0thread\u00a0=\u00a0Thread.currentThread();<br style=\"outline: 0px;\" \/>\u00a0\u00a0String\u00a0threadName\u00a0=\u00a0thread.getName();<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u521d\u59cb\u5316\u8ba1\u6570\u5668<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0CountDownLatch\u00a0mainDownLatch\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0CountDownLatch(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">1<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0CountDownLatch\u00a0sonDownLatch\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0CountDownLatch(mainTransaction.value());<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/@MainTransaction\u6ce8\u89e3\u4e2d\u7684\u53c2\u6570,\u00a0\u4e3a\u5b50\u7ebf\u7a0b\u7684\u6570\u91cf<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u7528\u6765\u8bb0\u5f55\u5b50\u7ebf\u7a0b\u7684\u8fd0\u884c\u72b6\u6001\uff0c\u53ea\u8981\u6709\u4e00\u4e2a\u5931\u8d25\u5c31\u53d8\u4e3atrue<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0AtomicBoolean\u00a0rollBackFlag\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0AtomicBoolean(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">false<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\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><br style=\"outline: 0px;\" \/>\u00a0\u00a0Vector&lt;Throwable&gt;\u00a0exceptionVector\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0Vector&lt;&gt;();<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0map.put(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"mainDownLatch\"<\/span>,\u00a0mainDownLatch);<br style=\"outline: 0px;\" \/>\u00a0\u00a0map.put(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"sonDownLatch\"<\/span>,\u00a0sonDownLatch);<br style=\"outline: 0px;\" \/>\u00a0\u00a0map.put(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"rollBackFlag\"<\/span>,\u00a0rollBackFlag);<br style=\"outline: 0px;\" \/>\u00a0\u00a0map.put(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"exceptionVector\"<\/span>,\u00a0exceptionVector);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">try<\/span>\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0joinPoint.proceed();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u6267\u884c\u65b9\u6cd5<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0}\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">catch<\/span>\u00a0(Throwable\u00a0e)\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0exceptionVector.add(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">0<\/span>,\u00a0e);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0rollBackFlag.set(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">true<\/span>);<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u5b50\u7ebf\u7a0b\u56de\u6eda<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0mainDownLatch.countDown();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u653e\u884c\u6240\u6709\u5b50\u7ebf\u7a0b<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">if<\/span>\u00a0(!rollBackFlag.get())\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">try<\/span>\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0sonDownLatch\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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0sonDownLatch.await();<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0mainDownLatch.countDown();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u6839\u636erollBackFlag\u72b6\u6001\u653e\u884c\u5b50\u7ebf\u7a0b\u7684await\u5904\uff0c\u544a\u77e5\u662f\u56de\u6eda\u8fd8\u662f\u63d0\u4ea4<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0}\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">catch<\/span>\u00a0(Exception\u00a0e)\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0rollBackFlag.set(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">true<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0exceptionVector.add(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">0<\/span>,\u00a0e);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">if<\/span>\u00a0(CollectionUtils.isNotEmpty(exceptionVector))\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0map.remove(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"mainDownLatch\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0map.remove(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"sonDownLatch\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0map.remove(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"rollBackFlag\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0map.remove(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"exceptionVector\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">throw<\/span>\u00a0exceptionVector.get(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">0<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Around<\/span>(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"@annotation(com.huigu.common.anno.SonTransaction)\"<\/span>)<br style=\"outline: 0px;\" \/>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">sonIntercept<\/span><span style=\"outline: 0px; line-height: 26px;\">(ProceedingJoinPoint\u00a0joinPoint)<\/span>\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">throws<\/span>\u00a0Throwable\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0Object[]\u00a0args\u00a0=\u00a0joinPoint.getArgs();<br style=\"outline: 0px;\" \/>\u00a0\u00a0Thread\u00a0thread\u00a0=\u00a0(Thread)\u00a0args[args.length\u00a0-\u00a0<span style=\"outline: 0px; color: #986801; line-height: 26px;\">1<\/span>];<br style=\"outline: 0px;\" \/>\u00a0\u00a0String\u00a0threadName\u00a0=\u00a0thread.getName();<br style=\"outline: 0px;\" \/>\u00a0\u00a0CountDownLatch\u00a0mainDownLatch\u00a0=\u00a0(CountDownLatch)\u00a0map.get(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"mainDownLatch\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">if<\/span>\u00a0(mainDownLatch\u00a0==\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">null<\/span>)\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u4e3b\u4e8b\u52a1\u672a\u52a0\u6ce8\u89e3\u65f6,\u00a0\u76f4\u63a5\u6267\u884c\u5b50\u4e8b\u52a1<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0joinPoint.proceed();<span style=\"outline: 0px; color: #a0a1a7; 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,\u00a0\u6b22\u8fce\u5927\u795e\u6765\u4f18\u5316,\u00a0\u7559\u8a00\u5206\u4eab<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">return<\/span>;<br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0\u00a0CountDownLatch\u00a0sonDownLatch\u00a0=\u00a0(CountDownLatch)\u00a0map.get(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"sonDownLatch\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0AtomicBoolean\u00a0rollBackFlag\u00a0=\u00a0(AtomicBoolean)\u00a0map.get(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"rollBackFlag\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0Vector&lt;Throwable&gt;\u00a0exceptionVector\u00a0=\u00a0(Vector&lt;Throwable&gt;)\u00a0map.get(threadName\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"exceptionVector\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; 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><br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">if<\/span>\u00a0(rollBackFlag.get())\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0sonDownLatch.countDown();<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">return<\/span>;<br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0DefaultTransactionDefinition\u00a0def\u00a0=\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">new<\/span>\u00a0DefaultTransactionDefinition();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5f00\u542f\u4e8b\u52a1<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u8bbe\u7f6e\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0TransactionStatus\u00a0status\u00a0=\u00a0transactionManager.getTransaction(def);<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">try<\/span>\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0joinPoint.proceed();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u6267\u884c\u65b9\u6cd5<\/span><br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0sonDownLatch.countDown();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5bf9sonDownLatch-1<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0mainDownLatch.await();<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5982\u679cmainDownLatch\u4e0d\u662f0\uff0c\u7ebf\u7a0b\u4f1a\u5728\u6b64\u963b\u585e\uff0c\u76f4\u5230mainDownLatch\u53d8\u4e3a0<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\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><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">if<\/span>\u00a0(rollBackFlag.get())\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0transactionManager.rollback(status);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0}\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">else<\/span>\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0transactionManager.commit(status);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0\u00a0}\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">catch<\/span>\u00a0(Throwable\u00a0e)\u00a0{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0exceptionVector.add(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">0<\/span>,\u00a0e);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u56de\u6eda<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0transactionManager.rollback(status);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5e76\u628a\u72b6\u6001\u8bbe\u7f6e\u4e3atrue<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0rollBackFlag.set(<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">true<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0mainDownLatch.countDown();<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0sonDownLatch.countDown();<br style=\"outline: 0px;\" \/>\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0}<br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong style=\"outline: 0px; color: #2584b5;\">\u6269\u5c55\u8bf4\u660e: CountDownLatch\u662f\u4ec0\u4e48?<\/strong><\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4e00\u4e2a\u540c\u6b65\u8f85\u52a9\u7c7b<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; outline: 0px; line-height: 26px; color: #010101;\">\u521b\u5efa\u5bf9\u8c61\u65f6: \u7528\u7ed9\u5b9a\u7684\u6570\u5b57\u521d\u59cb\u5316\u00a0<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">CountDownLatch<\/code><\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; outline: 0px; line-height: 26px; color: #010101;\"><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">countDown()<\/code>\u00a0\u65b9\u6cd5: \u4f7f\u8ba1\u6570\u51cf1<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; outline: 0px; line-height: 26px; color: #010101;\"><code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">await()<\/code>\u00a0\u65b9\u6cd5: \u963b\u585e\u5f53\u524d\u7ebf\u7a0b, \u76f4\u81f3\u5f53\u524d\u8ba1\u6570\u5230\u8fbe\u96f6\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u672c\u6587\u4e2d:<\/p>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7528 \u8ba1\u6570 1 \u521d\u59cb\u5316\u7684\u00a0<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">mainDownLatch<\/code>\u00a0\u5f53\u4f5c\u4e00\u4e2a\u7b80\u5355\u7684\u5f00\/\u5173\u9501\u5b58\u5668\uff0c\u6216\u5165\u53e3\uff1a\u5728\u901a\u8fc7\u8c03\u7528\u00a0<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">countDown()<\/code>\u00a0\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 style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7528 \u5b50\u7ebf\u7a0b\u6570\u91cf \u521d\u59cb\u5316\u7684\u00a0<code style=\"margin-right: 2px; margin-left: 2px; padding: 2px 4px; outline: 0px; font-size: 14px; border-radius: 4px; color: #1e6bb8; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all;\">sonDownLatch<\/code>\u00a0\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<p style=\"margin: 10px; padding-top: 8px; padding-bottom: 8px; outline: 0px; text-wrap: wrap; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; text-align: left; background-color: #ffffff; color: black; line-height: 1.75; letter-spacing: 0.2em; font-size: 15px; word-spacing: 0.1em; visibility: visible;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7ed9\u5927\u5bb6\u63a8\u8350\u4e00\u6b3e\u6211\u4eec\u81ea\u5df1\u5f00\u53d1\u7684Chrome\u63d2\u4ef6\uff1aYoutube\u4e2d\u6587\u914d\u97f3\u3002\u5982\u679c\u60a8\u8ddf\u6211\u4eec\u4e00\u6837\uff0c\u70ed\u7231\u770b\u56fd\u5916\u7684\u89c6\u9891\u5b66\u4e60\u524d\u6cbf\u77e5\u8bc6\u6216\u8005\u5176\u4ed6\u5185\u5bb9\uff0c\u8be5\u63d2\u4ef6\u53ef\u4ee5\u5f88\u597d\u7684\u5e2e\u52a9\u60a8\u8bb2\u5916\u8bed\u89c6\u9891\u4e00\u952e\u8f6c\u5316\u4e3a\u4e2d\u6587\u89c6\u9891\uff01<\/p>\n<p style=\"margin-bottom: 0px; outline: 0px; font-family: system-ui, -apple-system, 'system-ui', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; text-wrap: wrap; color: #2b2b2b; font-size: 16px; background-color: #ffffff; text-align: center; visibility: visible;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" style=\"outline: 0px; visibility: visible !important; width: 335px !important;\" data-galleryid=\"\" data-ratio=\"0.7580174927113703\" data-s=\"300,640\" data-type=\"png\" data-w=\"1029\" data-data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" \/><noscript><img class=\"rich_pages wxw-img\" style=\"outline: 0px; visibility: visible !important; width: 335px !important;\" data-galleryid=\"\" data-ratio=\"0.7580174927113703\" data-s=\"300,640\" data-type=\"png\" data-w=\"1029\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1\" \/><\/noscript><\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; outline: 0px; font-weight: bold; font-size: 20px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"padding: 2px 10px; outline: 0px; font-size: 16px; border-bottom: 1px solid #2584b5; color: #2584b5;\">\u6ce8\u89e3\u4f7f\u7528Demo<\/span><\/h3>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4efb\u52a1\u65b9\u6cd5:<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">package<\/span>\u00a0com.example.demo.service;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0com.example.demo.anno.SonTransaction;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.scheduling.annotation.Async;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.stereotype.Service;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.annotation.Transactional;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0*\u00a0\u6d4b\u8bd5\u5b50service<br style=\"outline: 0px;\" \/>\u00a0*\/<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Service<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">SonService<\/span>\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u53c2\u6570\u8bf4\u660e:\u00a0\u00a0\u4ee5\u4e0b4\u4e2a\u65b9\u6cd5\u53c2\u6570\u548c\u6b64\u76f8\u540c<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">@param<\/span>\u00a0args\u00a0\u00a0\u00a0\u4e1a\u52a1\u4e2d\u9700\u8981\u4f20\u9012\u7684\u53c2\u6570<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">@param<\/span>\u00a0thread\u00a0\u8c03\u7528\u8005\u7684\u7ebf\u7a0b,\u00a0\u7528\u4e8eaop\u83b7\u53d6\u53c2\u6570,\u00a0\u4e0d\u5efa\u8bae\u4ee5\u65b9\u6cd5\u91cd\u5199\u7684\u65b9\u5f0f\u7b80\u7565\u6b64\u53c2\u6570,<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\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<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4f20\u53c2\u65f6\u53c2\u6570\u56fa\u5b9a\u4e3a:\u00a0Thread.currentThread()<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Async<\/span>(\"<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">threadPoolTaskExecutor<\/span>\")<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">SonTransaction<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">sonMethod1<\/span>(<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">args<\/span>,\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Thread<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">thread<\/span>)\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(args\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Async<\/span>(\"<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">threadPoolTaskExecutor<\/span>\")<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">SonTransaction<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">sonMethod2<\/span>(<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">args1<\/span>,\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">args2<\/span>,\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Thread<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">thread<\/span>)\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(args1\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u548c\"<\/span>\u00a0+\u00a0args2\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Async<\/span>(\"<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">threadPoolTaskExecutor<\/span>\")<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0@<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">SonTransaction<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">sonMethod3<\/span>(<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">args<\/span>,\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">Thread<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">thread<\/span>)\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(args\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5f00\u542f\u4e86\u7ebf\u7a0b\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/sonMethod4\u65b9\u6cd5\u6ca1\u6709\u4f7f\u7528\u7ebf\u7a0b\u6c60<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">sonMethod4<\/span>(<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">String<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">args<\/span>)\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(args\u00a0+\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u6ca1\u6709\u5f00\u542f\u7ebf\u7a0b\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u8c03\u7528\u65b9:<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; outline: 0px; color: #000000; font-size: 16px; letter-spacing: normal; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 15px 16px 16px; outline: 0px; overflow-x: auto; color: #383a42; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #fafafa; border-radius: 5px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">package<\/span>\u00a0com.example.demo.service;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0com.example.demo.anno.MainTransaction;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.stereotype.Service;<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0org.springframework.transaction.annotation.Transactional;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">import<\/span>\u00a0javax.annotation.Resource;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/**<br style=\"outline: 0px;\" \/>\u00a0*\u00a0\u6d4b\u8bd5\u4e3bservice<br style=\"outline: 0px;\" \/>\u00a0*\/<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Service<\/span><br style=\"outline: 0px;\" \/><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; line-height: 26px;\"><span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">MainService<\/span>\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Resource<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">private<\/span>\u00a0SonService\u00a0sonService;<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@MainTransaction<\/span>(<span style=\"outline: 0px; color: #986801; line-height: 26px;\">3<\/span>)<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/\/\u8c03\u7528\u7684\u65b9\u6cd5\u4e2dsonMethod1\/sonMethod2\/sonMethod3\u4f7f\u7528@Async\u5f00\u542f\u4e86\u7ebf\u7a0b,\u00a0\u6240\u4ee5\u53c2\u6570\u4e3a:\u00a03<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">test1<\/span>()\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod1(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u8def\u98de\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod2(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u7d22\u9686\"<\/span>,\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5c71\u6cbb\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod3(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5a1c\u7f8e\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod4(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u7f57\u5bbe\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #a0a1a7; font-style: italic; line-height: 26px;\">\/*<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u6709\u7684\u4e1a\u52a1\u4e2d\u5b58\u5728if\u7684\u591a\u79cd\u53ef\u80fd,\u00a0\u6bcf\u4e00\u79cd\u8d70\u5411\u8c03\u7528\u7684\u65b9\u6cd5(\u5f00\u542f\u7ebf\u7a0b\u7684\u65b9\u6cd5)\u6570\u91cf\u5982\u679c\u4e0d\u540c,\u00a0\u8fd9\u65f6\u53ef\u4ee5\u9009\u62e9\u653e\u5f03\u4f7f\u7528@MainTransaction\u6ce8\u89e3\u907f\u514d\u9501\u8868<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u8fd9\u65f6\u5019\u5982\u679c\u53d1\u751f\u5f02\u5e38\u4f1a\u5bfc\u81f4\u591a\u7ebf\u7a0b\u4e0d\u80fd\u540c\u65f6\u56de\u6eda,\u00a0\u53ef\u6839\u636e\u4e1a\u52a1\u81ea\u5df1\u6743\u8861\u662f\u5426\u4f7f\u7528<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span><br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #4078f2; line-height: 26px;\">@Transactional<\/span>(rollbackFor\u00a0=\u00a0Exception<span style=\"outline: 0px; line-height: 26px;\">.<span style=\"outline: 0px; color: #a626a4; line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">public<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">void<\/span>\u00a0<span style=\"outline: 0px; color: #c18401; line-height: 26px;\">test2<\/span>()\u00a0<\/span>{<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod1(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u8def\u98de\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod2(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u7d22\u9686\"<\/span>,\u00a0<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5c71\u6cbb\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod3(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u5a1c\u7f8e\"<\/span>,\u00a0Thread.currentThread());<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sonService.sonMethod4(<span style=\"outline: 0px; color: #50a14f; line-height: 26px;\">\"\u7f57\u5bbe\"<\/span>);<br style=\"outline: 0px;\" \/>\u00a0\u00a0\u00a0\u00a0}<br style=\"outline: 0px;\" \/>\u00a0<br style=\"outline: 0px;\" \/>}<br style=\"outline: 0px;\" \/><\/code><\/pre>\n<p style=\"margin-bottom: 0px; padding-top: 8px; padding-bottom: 8px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-align: left; text-wrap: wrap; background-color: #ffffff; line-height: 26px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6709\u7684\u4e1a\u52a1\u4e2d\u5b58\u5728\u6bd4\u8f83\u590d\u6742\u7684\u5206\u652f, \u4e0d\u540c\u60c5\u51b5\u90fd\u4f1a\u8c03\u7528\u4e0d\u540c\u7684\u65b9\u6cd5\uff0c\u5f00\u542f\u4e0d\u540c\u6570\u91cf\u7684\u7ebf\u7a0b\uff0c\u8fd9\u65f6\u53ef\u4ee5\u9009\u62e9\u653e\u5f03\u4f7f\u7528@MainTransaction\u6ce8\u89e3\u907f\u514d\u9501\u8868\uff0c\u56e0\u6b64\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u6743\u8861\u3002<\/p>\n<p style=\"margin-bottom: 0px; outline: 0px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; letter-spacing: normal; text-wrap: wrap; background-color: #ffffff; text-align: right;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"outline: 0px; font-size: 12px; color: #b2b2b2;\">\u6765\u6e90\uff1ablog.csdn.net\/weixin_69672118\/<\/span><span style=\"outline: 0px; font-size: 12px; color: #b2b2b2;\">article\/details\/127675808<\/span><\/p>\n<section style=\"margin-right: 8px; margin-left: 8px; max-width: 100%; white-space: normal; outline: 0px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; overflow-wrap: break-word !important; box-sizing: border-box !important; margin-bottom: 0px;\"><\/section>\n<section style=\"max-width: 100%; margin-left: 8px; margin-right: 8px; text-align: center; overflow-wrap: break-word !important; box-sizing: border-box !important; margin-bottom: 0px;\"><\/section>\n<section class=\"mp_profile_iframe_wrp\"><\/section>\n<section style=\"max-width: 100%; white-space: normal; text-align: right; margin-left: 8px; margin-right: 8px; margin-bottom: 0px; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg lazyload\" style=\"width: 358.359px; overflow-wrap: break-word !important;\" data-ratio=\"0.09418282548476455\" data-s=\"300,640\" data-data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-20\/20230830142320e7e7f44a2.png?wx_fmt=png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-type=\"png\" data-w=\"361\" \/><noscript><img class=\"rich_pages wxw-img js_insertlocalimg\" style=\"width: 358.359px; overflow-wrap: break-word !important;\" data-ratio=\"0.09418282548476455\" data-s=\"300,640\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-20\/20230830142320e7e7f44a2.png?wx_fmt=png\" data-type=\"png\" data-w=\"361\" \/><\/noscript><\/section>\n<p style=\"display: none;\">\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4f5c\u8005\uff1aSpringForAll\u793e\u533a SpringForAll\u793e\u533a \u5fae\u4fe1\u53f7 spring4all \u529f\u80fd\u4ecb\u7ecd \u5206\u4eab\u5173\u4e8eSpring\u7684\u4e00\u5207 \u53d1\u8868\u4e8e<br \/>\n\u8f6c\u8f7d\u5730\u5740\uff1ahttps:\/\/mp.weixin.qq.com\/s\/qVFu63wzQ-7jtka-lHMG6Q<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\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\u3002 \u539f &#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":[7],"tags":[],"class_list":["post-3095","post","type-post","status-publish","format-standard","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-19\/202308301423197e7e980d1.png?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-20\/20230830142320e7e7f44a2.png?wx_fmt=png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-08-30\/14-23-20\/20230830142320e7e7f44a2.png?wx_fmt=png","id":"image3"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2023-08-31","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":382,"next_post_id":3093,"next_post_title":"Java\u9879\u76ee\u9632\u6b62SQL\u6ce8\u5165\u7684\u56db\u79cd\u65b9\u6848","previous_post_id":3089,"previous_post_title":"\u9664\u4e86\u7f13\u5b58\uff0c\u6027\u80fd\u4f18\u5316\u8fd8\u53ef\u4ee5\u8fd9\u4e48\u641e\uff1f","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3095","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=3095"}],"version-history":[{"count":2,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3095\/revisions"}],"predecessor-version":[{"id":3104,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3095\/revisions\/3104"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}