{"id":203839,"date":"2025-05-22T10:05:35","date_gmt":"2025-05-22T02:05:35","guid":{"rendered":"https:\/\/server.hk\/cnblog\/203839\/"},"modified":"2025-05-22T10:05:35","modified_gmt":"2025-05-22T02:05:35","slug":"springboot%e9%9b%86%e6%88%90mybatis-plus%e5%87%ba%e7%8e%b0nosuchmethoderror%e5%bc%82%e5%b8%b8%ef%bc%8c%e8%af%a5%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/203839\/","title":{"rendered":"SpringBoot\u96c6\u6210Mybatis-plus\u51fa\u73b0NoSuchMethodError\u5f02\u5e38\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>SpringBoot\u96c6\u6210Mybatis-plus\u51fa\u73b0NoSuchMethodError\u5f02\u5e38\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f<\/h1>\n<p><span style=\"font-size: 15px\">\u5b66\u4e60\u77e5\u8bc6\u8981\u5584\u4e8e\u601d\u8003\uff0c\u601d\u8003\uff0c\u518d\u601d\u8003\uff01\u4eca\u5929\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aSpringBoot\u96c6\u6210Mybatis-plus\u51fa\u73b0NoSuchMethodError\u5f02\u5e38\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f\u300b<\/span>\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6216\u51c6\u5907\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u5c31\u90fd\u4e0d\u8981\u9519\u8fc7\u672c\u6587\u5566~\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff0c\u80fd\u5e2e\u52a9\u5230\u4f60\u5c31\u66f4\u597d\u4e86\uff01<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241127\/17326939046746cf90efb5a.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>SpringBoot\u4f7f\u7528Mybatis-plus\u62a5NoSuchMethodError\u5f02\u5e38\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p>\u5728Spring Boot\u5e94\u7528\u96c6\u6210Mybatis-plus\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u201cjava.lang.NoSuchMethodError\u201d\u5f02\u5e38\uff0c\u63d0\u793a\u65b9\u6cd5\u4e0d\u5b58\u5728\u3002\u672c\u6587\u8be6\u7ec6\u5206\u6790\u6b64\u95ee\u9898\u7684\u5e38\u89c1\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u8be5\u5f02\u5e38\u7684\u51fa\u73b0\u901a\u5e38\u662f\u56e0\u4e3aMapper\u63a5\u53e3\u7684\u65b9\u6cd5\u4e0eMapper XML\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684SQL\u8bed\u53e5\u4e0d\u4e00\u81f4\u3002\u5177\u4f53\u6765\u8bf4\uff0cMapper\u63a5\u53e3\u4e2d\u5b58\u5728\u7684\u65b9\u6cd5\u5728XML\u6587\u4ef6\u4e2d\u6ca1\u6709\u76f8\u5e94\u7684SQL\u8bed\u53e5\u5b9e\u73b0\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p><strong>1. \u68c0\u67e5XML\u6587\u4ef6<\/strong><\/p>\n<p>\u786e\u4fddMapper XML\u6587\u4ef6\u5df2\u6b63\u786e\u7f16\u8bd1\u5e76\u5305\u542b\u5bf9\u5e94Mapper\u63a5\u53e3\u4e2d\u6240\u6709\u65b9\u6cd5\u7684SQL\u8bed\u53e5\u3002\u5982\u679cXML\u6587\u4ef6\u6ca1\u6709\u7f16\u8bd1\u5230\u6e90\u7801\u76ee\u5f55\u4e2d\uff0c\u4f1a\u5bfc\u81f4Mybatis\u627e\u4e0d\u5230\u76f8\u5e94\u7684SQL\u8bed\u53e5\u5e76\u629b\u51fa\u5f02\u5e38\u3002<\/p>\n<p><strong>2. \u6e05\u7406\u9879\u76ee<\/strong><\/p>\n<p>\u6709\u65f6\uff0cIDE\u4e2d\u53ef\u80fd\u5b58\u5728\u4e00\u4e9b\u7f13\u5b58\u6587\u4ef6\u5bfc\u81f4\u95ee\u9898\u3002\u5c1d\u8bd5\u6e05\u7406\u9879\u76ee\uff0c\u5373\u5220\u9664\u201ctarget\u201d\u6216\u201cbuild\u201d\u76ee\u5f55\uff0c\u7136\u540e\u91cd\u65b0\u7f16\u8bd1\u9879\u76ee\u3002<\/p>\n<p><strong>3. \u5347\u7ea7Mybatis-plus\u7248\u672c<\/strong><\/p>\n<p>\u5982\u679cXML\u6587\u4ef6\u6ca1\u6709\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5347\u7ea7Mybatis-plus\u7248\u672c\u3002\u8f83\u65b0\u7248\u672c\u53ef\u80fd\u5df2\u7ecf\u4fee\u590d\u4e86\u6b64\u95ee\u9898\u3002<\/p>\n<p><strong>4. \u68c0\u67e5\u5176\u4ed6\u914d\u7f6e<\/strong><\/p>\n<p>\u786e\u4fdd\u201cmybatis-plus.mapper-locations\u201d\u5c5e\u6027\u5728Spring Boot\u914d\u7f6e\u6587\u4ef6\uff08application.properties\u6216application.yml\uff09\u4e2d\u6b63\u786e\u8bbe\u7f6e\uff0c\u4ee5\u6307\u5b9aMybatis\u626b\u63cfXML\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<p><strong>5. \u91cd\u65b0\u542f\u52a8\u5e94\u7528<\/strong><\/p>\n<p>\u5728\u8fdb\u884c\u4efb\u4f55\u66f4\u6539\u540e\uff0c\u8bf7\u91cd\u65b0\u542f\u52a8Spring Boot\u5e94\u7528\uff0c\u4ee5\u4fbf\u6700\u65b0\u7684\u914d\u7f6e\u751f\u6548\u3002<\/p>\n<p><strong>6. \u5bfc\u5165\u65b0\u7684Mybatis-plus\u6a21\u5757<\/strong><\/p>\n<p>\u5982\u679c\u4e0a\u8ff0\u65b9\u6cd5\u90fd\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5bfc\u5165\u4e00\u4e2a\u65b0\u7684Mybatis-plus\u6a21\u5757\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3aSpringBoot\u5e94\u7528\u7684\u4f9d\u8d56\u9879\u3002\u6b64\u6a21\u5757\u5e94\u8be5\u5305\u542b\u6240\u6709\u5fc5\u8981\u7684XML\u6587\u4ef6\u548c\u914d\u7f6e\u3002<\/p>\n<p>\u901a\u8fc7\u9075\u5faa\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u53ef\u4ee5\u89e3\u51b3SpringBoot\u4f7f\u7528Mybatis-plus\u9047\u5230\u7684\u201cNoSuchMethodError\u201d\u5f02\u5e38\u95ee\u9898\uff0c\u786e\u4fddMapper\u63a5\u53e3\u65b9\u6cd5\u548cXML\u6587\u4ef6\u914d\u7f6e\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aSpringBoot\u96c6\u6210Mybatis-plus\u51fa\u73b0NoSuchMethodError\u5f02\u5e38\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SpringBoot\u96c6\u6210Myba&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-203839","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=203839"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203839\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=203839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=203839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=203839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}