{"id":48867,"date":"2024-12-02T11:25:18","date_gmt":"2024-12-02T03:25:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/48867\/"},"modified":"2024-12-02T11:25:18","modified_gmt":"2024-12-02T03:25:18","slug":"springboot-%e4%ba%8b%e5%8a%a1%e5%9b%9e%e6%bb%9a%e8%bf%b7%e5%b1%80%ef%bc%9a%e5%b1%82%e5%b1%82%e8%b0%83%e7%94%a8%ef%bc%8c%e4%ba%8b%e5%8a%a1%e8%be%b9%e7%95%8c%e5%a6%82%e4%bd%95%e7%95%8c%e5%ae%9a%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/48867\/","title":{"rendered":"SpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>SpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f<\/h1>\n<p>\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aSpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f\u300b<\/span>\u4e3b\u8981\u8bb2\u89e3\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728\u7c73\u4e91\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241118\/1731890753673a8e41dfb36.jpg\" class=\"aligncenter\" title=\"SpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f\u63d2\u56fe\" alt=\"SpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>springboot \u4e8b\u52a1\u56de\u6eda\u8c1c\u56e2\uff1a\u5c42\u5c42\u8c03\u7528\u7684\u4e8b\u52a1\u8fb9\u754c<\/strong><\/p>\n<p>\u8003\u8651\u4ee5\u4e0b\u4ee3\u7801\u573a\u666f\uff1a<\/p>\n<pre>\u65b9\u6cd5 A \u8c03\u7528 B\uff0cB \u8c03\u7528 C\uff0cC \u8c03\u7528 D\uff0cD \u8c03\u7528 E\u3002A\u3001C\u3001D \u548c E \u5747\u4f4d\u4e8e\u540c\u4e00\u7c7b\u4e2d\uff0c\u4f46\u53ea\u6709 B \u6807\u8bb0\u4e86\u4e8b\u52a1\u3002<\/pre>\n<p>\u6b64\u65f6\uff0c\u5373\u4f7f e \u65b9\u6cd5\u51fa\u9519\uff0c\u4e8b\u52a1\u4e5f\u4e0d\u4f1a\u56de\u6eda\u3002\u539f\u56e0\u4f55\u5728\uff1f<\/p>\n<p><strong>\u6df1\u5165\u4e8b\u52a1\u8fb9\u754c<\/strong><\/p>\n<p>\u5728 springboot \u4e2d\uff0c\u4e8b\u52a1\u662f\u7531 @transactional \u6ce8\u89e3\u63a7\u5236\u7684\u3002\u5f53\u5728\u67d0\u4e2a\u65b9\u6cd5\u4e0a\u5e94\u7528\u6b64\u6ce8\u89e3\u65f6\uff0c\u5b83\u4fbf\u5f00\u542f\u4e86\u4e00\u4e2a\u4e8b\u52a1\u8303\u56f4\u3002\u5f53\u51fa\u73b0\u5f02\u5e38\u65f6\uff0c\u5982\u679c\u8be5\u65b9\u6cd5\u5904\u4e8e\u4e8b\u52a1\u8303\u56f4\u5185\uff0c\u5219\u8be5\u4e8b\u52a1\u5c06\u56de\u6eda\uff0c\u6240\u505a\u7684\u66f4\u6539\u5c06\u88ab\u64a4\u9500\u3002<\/p>\n<p><strong>\u4e8b\u52a1\u7684\u4f20\u64ad\u6027<\/strong><\/p>\n<p>\u7136\u800c\uff0c\u5f53\u65b9\u6cd5\u8c03\u7528\u5d4c\u5957\u4e8b\u52a1\u65f6\uff0c\u4e8b\u52a1\u7684\u4f20\u64ad\u6027\u5c31\u53d8\u5f97\u81f3\u5173\u91cd\u8981\u3002\u6709\u4e24\u79cd\u4e3b\u8981\u4f20\u64ad\u6027\u7ea7\u522b\uff1a<\/p>\n<ul>\n<li><strong>required\uff1a<\/strong>\u5982\u679c\u5b58\u5728\u7236\u4e8b\u52a1\uff0c\u5219\u52a0\u5165\u8be5\u4e8b\u52a1\uff1b\u5426\u5219\uff0c\u5f00\u542f\u4e00\u4e2a\u65b0\u4e8b\u52a1\u3002<\/li>\n<li><strong>not_supported\uff1a<\/strong>\u6682\u505c\u5f53\u524d\u4e8b\u52a1\uff0c\u5728\u975e\u4e8b\u52a1\u6027\u73af\u5883\u4e2d\u6267\u884c\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<p><strong>springboot \u7684\u4e8b\u52a1\u9ed8\u8ba4\u4f20\u64ad\u6027<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cspringboot \u4f7f\u7528 required \u4f20\u64ad\u6027\u7ea7\u522b\u3002\u8fd9\u610f\u5473\u7740\u53ea\u6709\u5f53\u6700\u5916\u5c42\u65b9\u6cd5\u6807\u8bb0\u4e86\u4e8b\u52a1\u65f6\uff0c\u6574\u4e2a\u65b9\u6cd5\u8c03\u7528\u94fe\u4e2d\u7684\u4e8b\u52a1\u624d\u4f1a\u88ab\u89e6\u53d1\u3002<\/p>\n<p><strong>\u672c\u6848\u4f8b\u7684\u89e3\u91ca<\/strong><\/p>\n<p>\u5728\u7ed9\u5b9a\u573a\u666f\u4e2d\uff0c\u7531\u4e8e\u53ea\u6709 b \u65b9\u6cd5\u6807\u8bb0\u4e86\u4e8b\u52a1\uff0c\u56e0\u6b64 a\u3001c\u3001d \u548c e \u65b9\u6cd5\u90fd\u5728\u975e\u4e8b\u52a1\u6027\u73af\u5883\u4e2d\u6267\u884c\u3002\u5f53 e \u65b9\u6cd5\u51fa\u9519\u65f6\uff0c\u7531\u4e8e\u6ca1\u6709\u7236\u4e8b\u52a1\uff0c\u4e8b\u52a1\u4e0d\u4f1a\u56de\u6eda\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p>\u8981\u60f3\u8ba9\u4e8b\u52a1\u5bf9\u6574\u4e2a\u65b9\u6cd5\u8c03\u7528\u94fe\u8d77\u4f5c\u7528\uff0c\u6709\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>\u4e3a\u6700\u5916\u5c42\u65b9\u6cd5 a \u6dfb\u52a0 @transactional \u6ce8\u89e3\uff0c\u4ee5\u8986\u76d6\u9ed8\u8ba4\u7684\u4f20\u64ad\u6027\u3002<\/li>\n<li>\u66f4\u6539 b \u65b9\u6cd5\u7684\u4e8b\u52a1\u4f20\u64ad\u6027\u4e3a not_supported\uff0c\u4ee5\u4fbf\u5d4c\u5957\u65b9\u6cd5\u80fd\u591f\u5728\u81ea\u5df1\u7684\u4e8b\u52a1\u4e2d\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300aSpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u7c73\u4e91\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6587\u7ae0\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f \u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587\u300aSpringBoot \u4e8b\u52a1\u56de\u6eda\u8ff7\u5c40\uff1a\u5c42\u5c42\u8c03\u7528\uff0c\u4e8b\u52a1\u8fb9\u754c\u5982\u4f55\u754c\u5b9a\uff1f\u300b\u4e3b\u8981\u8bb2\u89e3\u4e86\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728\u7c73\u4e91\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01 springboot \u4e8b\u52a1\u56de\u6eda\u8c1c\u56e2\uff1a\u5c42\u5c42\u8c03\u7528\u7684\u4e8b\u52a1\u8fb9\u754c \u8003\u8651\u4ee5\u4e0b\u4ee3\u7801\u573a\u666f\uff1a \u65b9\u6cd5 A \u8c03\u7528 B\uff0cB \u8c03\u7528 C\uff0cC \u8c03\u7528 D\uff0cD \u8c03\u7528 E\u3002A\u3001C\u3001D \u548c E \u5747\u4f4d\u4e8e\u540c\u4e00\u7c7b\u4e2d\uff0c\u4f46\u53ea\u6709 B \u6807\u8bb0\u4e86\u4e8b\u52a1\u3002 \u6b64\u65f6\uff0c\u5373\u4f7f e \u65b9\u6cd5\u51fa\u9519\uff0c\u4e8b\u52a1\u4e5f\u4e0d\u4f1a\u56de\u6eda\u3002\u539f\u56e0\u4f55\u5728\uff1f \u6df1\u5165\u4e8b\u52a1\u8fb9\u754c \u5728 springboot \u4e2d\uff0c\u4e8b\u52a1\u662f\u7531 @transactional \u6ce8\u89e3\u63a7\u5236\u7684\u3002\u5f53\u5728\u67d0\u4e2a\u65b9\u6cd5\u4e0a\u5e94\u7528\u6b64\u6ce8\u89e3\u65f6\uff0c\u5b83\u4fbf\u5f00\u542f\u4e86\u4e00\u4e2a\u4e8b\u52a1\u8303\u56f4\u3002\u5f53\u51fa\u73b0\u5f02\u5e38\u65f6\uff0c\u5982\u679c\u8be5\u65b9\u6cd5\u5904\u4e8e\u4e8b\u52a1\u8303\u56f4\u5185\uff0c\u5219\u8be5\u4e8b\u52a1\u5c06\u56de\u6eda\uff0c\u6240\u505a\u7684\u66f4\u6539\u5c06\u88ab\u64a4\u9500\u3002 \u4e8b\u52a1\u7684\u4f20\u64ad\u6027 \u7136\u800c\uff0c\u5f53\u65b9\u6cd5\u8c03\u7528\u5d4c\u5957\u4e8b\u52a1\u65f6\uff0c\u4e8b\u52a1\u7684\u4f20\u64ad\u6027\u5c31\u53d8\u5f97\u81f3\u5173\u91cd\u8981\u3002\u6709\u4e24\u79cd\u4e3b\u8981\u4f20\u64ad\u6027\u7ea7\u522b\uff1a required\uff1a\u5982\u679c\u5b58\u5728\u7236\u4e8b\u52a1\uff0c\u5219\u52a0\u5165\u8be5\u4e8b\u52a1\uff1b\u5426\u5219\uff0c\u5f00\u542f\u4e00\u4e2a\u65b0\u4e8b\u52a1\u3002 not_supported\uff1a\u6682\u505c\u5f53\u524d\u4e8b\u52a1\uff0c\u5728\u975e\u4e8b\u52a1\u6027\u73af\u5883\u4e2d\u6267\u884c\u65b9\u6cd5\u3002 springboot \u7684\u4e8b\u52a1\u9ed8\u8ba4\u4f20\u64ad\u6027 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cspringboot \u4f7f\u7528 required \u4f20\u64ad\u6027\u7ea7\u522b\u3002\u8fd9\u610f\u5473\u7740\u53ea\u6709\u5f53\u6700\u5916\u5c42\u65b9\u6cd5\u6807\u8bb0\u4e86\u4e8b\u52a1\u65f6\uff0c\u6574\u4e2a\u65b9\u6cd5\u8c03\u7528\u94fe\u4e2d\u7684\u4e8b\u52a1\u624d\u4f1a\u88ab\u89e6\u53d1\u3002 \u672c\u6848\u4f8b\u7684\u89e3\u91ca \u5728\u7ed9\u5b9a\u573a\u666f\u4e2d\uff0c\u7531\u4e8e\u53ea\u6709 b \u65b9\u6cd5\u6807\u8bb0\u4e86\u4e8b\u52a1\uff0c\u56e0\u6b64 a\u3001c\u3001d \u548c e \u65b9\u6cd5\u90fd\u5728\u975e\u4e8b\u52a1\u6027\u73af\u5883\u4e2d\u6267\u884c\u3002\u5f53 e \u65b9\u6cd5\u51fa\u9519\u65f6\uff0c\u7531\u4e8e\u6ca1\u6709\u7236\u4e8b\u52a1\uff0c\u4e8b\u52a1\u4e0d\u4f1a\u56de\u6eda\u3002 \u89e3\u51b3\u65b9\u6cd5 \u8981\u60f3\u8ba9\u4e8b\u52a1\u5bf9\u6574\u4e2a\u65b9\u6cd5\u8c03\u7528\u94fe\u8d77\u4f5c\u7528\uff0c\u6709\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\uff1a \u4e3a\u6700\u5916\u5c42\u65b9\u6cd5 a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-48867","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/48867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=48867"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/48867\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=48867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=48867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=48867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}