{"id":64411,"date":"2025-05-03T12:12:23","date_gmt":"2025-05-03T04:12:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64411\/"},"modified":"2025-05-03T12:12:23","modified_gmt":"2025-05-03T04:12:23","slug":"springboot-2-2-x-%e4%b8%8b%e5%a6%82%e4%bd%95%e4%bc%98%e9%9b%85%e5%9c%b0%e5%88%a4%e6%96%ad%e5%af%b9%e8%b1%a1%e4%b8%ba%e7%a9%ba%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64411\/","title":{"rendered":"SpringBoot 2.2.x \u4e0b\u5982\u4f55\u4f18\u96c5\u5730\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173059632554385.jpg\" class=\"aligncenter\" title=\"SpringBoot 2.2.x \u4e0b\u5982\u4f55\u4f18\u96c5\u5730\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\uff1f\u63d2\u56fe\" alt=\"SpringBoot 2.2.x \u4e0b\u5982\u4f55\u4f18\u96c5\u5730\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>SpringBoot 2.2.x \u4e0b\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\u65f6\u7684IDEA\u63d0\u793a\u5904\u7406<\/strong><\/p>\n<p>\u5728\u4f7f\u7528\u4e86Spring Boot 2.2.x \u6846\u67b6\u8fdb\u884cJPA\u67e5\u8be2\u65f6\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u4f1a\u9047\u5230IDE\u63d0\u793a\u7684\u5bf9\u8c61\u4e3a\u7a7a\uff0c\u5bfc\u81f4\u7684\u60c5\u51b5\u3002\u90a3\u4e48\uff0c\u5728\u8be5\u573a\u666f\u4e0b\uff0c\u5982\u4f55\u6b63\u786e\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a\u5462\uff1f<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u7684\u6839\u6e90\u5728\u4e8e\u5f00\u53d1\u8005\u5728\u8c03\u7528\u4e86\u4e00\u4e2a\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u65b9\u6cd5\u3002\u5f53\u7cfb\u7edf\u8ba4\u4e3a\u8be5\u5bf9\u8c61\u4e0d\u4f1a\u4e3a null \u65f6\uff0c\u4f46\u5f00\u53d1\u8005\u53c8\u8fdb\u884c\u4e86\u7a7a\u5224\u65ad\uff0c\u5c31\u4f1a\u5f15\u53d1\u63d0\u793a\u3002<\/p>\n<p>\u5bf9\u6b64\uff0c\u89e3\u51b3\u529e\u6cd5\u662f\uff1a\u907f\u514d\u8c03\u7528\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u65b9\u6cd5\u3002\u5982\u679c\u786e\u5b9e\u9700\u8981\u5224\u65ad\u5bf9\u8c61\u7684\u4e3a\u7a7a\u6027\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u5f0f\uff1a<\/p>\n<ol>\n<li> <strong>\u4f7f\u7528Java 8 Optional \u7c7b\uff1a<\/strong> Optional \u7c7b\u4e3a\u5904\u7406\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u63d0\u4f9b\u4e86\u4fbf\u5229\u65b9\u6cd5\u3002\u901a\u8fc7\u4f7f\u7528 Optional#isPresent() \u65b9\u6cd5\u53ef\u4ee5\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff0c\u907f\u514d\u4e86\u76f4\u63a5\u4f7f\u7528 null \u68c0\u67e5\u7684\u5f0a\u7aef\u3002<\/li>\n<li> <strong>\u4f7f\u7528Elvis \u8fd0\u7b97\u7b26\uff1a<\/strong> Elvis \u8fd0\u7b97\u7b26 (?:) \u662f\u4e00\u79cd\u4e09\u5143\u8fd0\u7b97\u7b26\uff0c\u5f53\u5de6\u64cd\u4f5c\u6570\u4e0d\u4e3a null \u65f6\uff0c\u8fd4\u56de\u5de6\u64cd\u4f5c\u6570\uff1b\u5426\u5219\uff0c\u8fd4\u56de\u53f3\u64cd\u4f5c\u6570\u3002\u8be5\u8fd0\u7b97\u7b26\u53ef\u4ee5\u7b80\u6d01\u660e\u4e86\u5730\u5904\u7406 null \u68c0\u67e5\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662fSpringBoot 2.2.x \u4e0b\u5982\u4f55\u4f18\u96c5\u5730\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SpringBoot 2.2.x \u4e0b\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\u65f6\u7684IDEA\u63d0\u793a\u5904\u7406 \u5728\u4f7f\u7528\u4e86Spring Boot 2.2.x \u6846\u67b6\u8fdb\u884cJPA\u67e5\u8be2\u65f6\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u4f1a\u9047\u5230IDE\u63d0\u793a\u7684\u5bf9\u8c61\u4e3a\u7a7a\uff0c\u5bfc\u81f4\u7684\u60c5\u51b5\u3002\u90a3\u4e48\uff0c\u5728\u8be5\u573a\u666f\u4e0b\uff0c\u5982\u4f55\u6b63\u786e\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a\u5462\uff1f \u8fd9\u4e2a\u95ee\u9898\u7684\u6839\u6e90\u5728\u4e8e\u5f00\u53d1\u8005\u5728\u8c03\u7528\u4e86\u4e00\u4e2a\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u65b9\u6cd5\u3002\u5f53\u7cfb\u7edf\u8ba4\u4e3a\u8be5\u5bf9\u8c61\u4e0d\u4f1a\u4e3a null \u65f6\uff0c\u4f46\u5f00\u53d1\u8005\u53c8\u8fdb\u884c\u4e86\u7a7a\u5224\u65ad\uff0c\u5c31\u4f1a\u5f15\u53d1\u63d0\u793a\u3002 \u5bf9\u6b64\uff0c\u89e3\u51b3\u529e\u6cd5\u662f\uff1a\u907f\u514d\u8c03\u7528\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u65b9\u6cd5\u3002\u5982\u679c\u786e\u5b9e\u9700\u8981\u5224\u65ad\u5bf9\u8c61\u7684\u4e3a\u7a7a\u6027\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u5f0f\uff1a \u4f7f\u7528Java 8 Optional \u7c7b\uff1a Optional \u7c7b\u4e3a\u5904\u7406\u53ef\u80fd\u4e3a null \u7684\u5bf9\u8c61\u63d0\u4f9b\u4e86\u4fbf\u5229\u65b9\u6cd5\u3002\u901a\u8fc7\u4f7f\u7528 Optional#isPresent() \u65b9\u6cd5\u53ef\u4ee5\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u5b58\u5728\uff0c\u907f\u514d\u4e86\u76f4\u63a5\u4f7f\u7528 null \u68c0\u67e5\u7684\u5f0a\u7aef\u3002 \u4f7f\u7528Elvis \u8fd0\u7b97\u7b26\uff1a Elvis \u8fd0\u7b97\u7b26 (?:) \u662f\u4e00\u79cd\u4e09\u5143\u8fd0\u7b97\u7b26\uff0c\u5f53\u5de6\u64cd\u4f5c\u6570\u4e0d\u4e3a null \u65f6\uff0c\u8fd4\u56de\u5de6\u64cd\u4f5c\u6570\uff1b\u5426\u5219\uff0c\u8fd4\u56de\u53f3\u64cd\u4f5c\u6570\u3002\u8be5\u8fd0\u7b97\u7b26\u53ef\u4ee5\u7b80\u6d01\u660e\u4e86\u5730\u5904\u7406 null \u68c0\u67e5\u3002 \u4ee5\u4e0a\u5c31\u662fSpringBoot 2.2.x \u4e0b\u5982\u4f55\u4f18\u96c5\u5730\u5224\u65ad\u5bf9\u8c61\u4e3a\u7a7a\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-64411","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64411","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=64411"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64411\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}