{"id":535,"date":"2023-05-28T02:11:03","date_gmt":"2023-05-27T18:11:03","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=535"},"modified":"2023-05-28T02:11:03","modified_gmt":"2023-05-27T18:11:03","slug":"controller%e5%b1%82%e4%bb%a3%e7%a0%81%e5%b0%b1%e8%af%a5%e8%bf%99%e4%b9%88%e5%86%99%ef%bc%8c%e7%ae%80%e6%b4%81%e5%8f%88%e4%bc%98%e9%9b%85%ef%bc%81","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/java\/controller%e5%b1%82%e4%bb%a3%e7%a0%81%e5%b0%b1%e8%af%a5%e8%bf%99%e4%b9%88%e5%86%99%ef%bc%8c%e7%ae%80%e6%b4%81%e5%8f%88%e4%bc%98%e9%9b%85%ef%bc%81\/","title":{"rendered":"Controller\u5c42\u4ee3\u7801\u5c31\u8be5\u8fd9\u4e48\u5199\uff0c\u7b80\u6d01\u53c8\u4f18\u96c5\uff01"},"content":{"rendered":"<div class='wxsyncmain'>\n<blockquote data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 20px;margin-bottom: 20px;padding: 15px 20px;outline: 0px;border-left-color: rgb(53, 179, 120);color: rgb(106, 115, 125);font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;border-top: none;border-right: none;border-bottom: none;overflow: auto;background: rgb(251, 249, 253);line-height: 27px;visibility: visible;\">\n<section style=\"outline: 0px;font-size: 15px;color: rgb(89, 89, 89);line-height: 1.5em;visibility: visible;\"><span style=\"outline: 0px;font-size: 12px;visibility: visible;\">\u4f5c\u8005\uff1agelald<\/span><\/section>\n<section style=\"outline: 0px;font-size: 15px;color: rgb(89, 89, 89);line-height: 1.5em;visibility: visible;\"><span style=\"outline: 0px;font-size: 12px;visibility: visible;\">\u6765\u6e90\uff1ajuejin.cn\/post\/7123091045071454238<\/span><\/section>\n<\/blockquote>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;visibility: visible;\">\u8bf4\u5230 Controller\uff0c\u76f8\u4fe1\u5927\u5bb6\u90fd\u4e0d\u964c\u751f\uff0c\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u5bf9\u5916\u63d0\u4f9b\u6570\u636e\u63a5\u53e3\u3002\u5b83\u7684\u5b9a\u4f4d\uff0c\u6211\u8ba4\u4e3a\u662f\u300c\u4e0d\u53ef\u6216\u7f3a\u7684\u914d\u89d2\u300d\uff0c\u8bf4\u5b83\u4e0d\u53ef\u6216\u7f3a\u662f\u56e0\u4e3a\u65e0\u8bba\u662f\u4f20\u7edf\u7684\u4e09\u5c42\u67b6\u6784\u8fd8\u662f\u73b0\u5728\u7684COLA\u67b6\u6784\uff0cController \u5c42\u4f9d\u65e7\u6709\u4e00\u5e2d\u4e4b\u5730\uff0c\u8bf4\u660e\u4ed6\u7684\u5fc5\u8981\u6027\uff1b\u8bf4\u5b83\u662f\u914d\u89d2\u662f\u56e0\u4e3a Controller \u5c42\u7684\u4ee3\u7801\u4e00\u822c\u662f\u4e0d\u8d1f\u8d23\u5177\u4f53\u7684\u903b\u8f91\u4e1a\u52a1\u903b\u8f91\u5b9e\u73b0\uff0c\u4f46\u662f\u5b83\u8d1f\u8d23\u63a5\u6536\u548c\u54cd\u5e94\u8bf7\u6c42<\/p>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1em;margin-bottom: 10px;outline: 0px;font-weight: bold;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;white-space: normal;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_png\/CKvMdchsUwkhJK4h7WQKWKAMrCbnicQrQLI7jMMPVAuZr3icop6VB9wQUAyKyAZCgbR5fnQljtU8VpoiaQ1HaiaG8g\/640?wx_fmt=png&quot;) center center \/ 50px no-repeat rgb(255, 255, 255);color: black;text-align: center;visibility: visible;\"><span style=\"margin-top: 38px;margin-bottom: 10px;outline: 0px;display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;font-size: 18px;visibility: visible;\">\u4ece\u73b0\u72b6\u770b\u95ee\u9898<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;visibility: visible;\">Controller \u4e3b\u8981\u7684\u5de5\u4f5c\u6709\u4ee5\u4e0b\u51e0\u9879<\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;visibility: visible;\">\n<li style=\"outline: 0px;visibility: visible;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);visibility: visible;\">\u63a5\u6536\u8bf7\u6c42\u5e76\u89e3\u6790\u53c2\u6570<\/section>\n<\/li>\n<li style=\"outline: 0px;visibility: visible;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);visibility: visible;\">\u8c03\u7528 Service \u6267\u884c\u5177\u4f53\u7684\u4e1a\u52a1\u4ee3\u7801\uff08\u53ef\u80fd\u5305\u542b\u53c2\u6570\u6821\u9a8c\uff09<\/section>\n<\/li>\n<li style=\"outline: 0px;visibility: visible;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);visibility: visible;\">\u6355\u83b7\u4e1a\u52a1\u903b\u8f91\u5f02\u5e38\u505a\u51fa\u53cd\u9988<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u4e1a\u52a1\u903b\u8f91\u6267\u884c\u6210\u529f\u505a\u51fa\u54cd\u5e94<\/section>\n<\/li>\n<\/ul>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/DTO<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Data<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestDTO<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;Integer&nbsp;num;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;type;<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/Service<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Service<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestService<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Double&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">service<\/span><span style=\"outline: 0px;line-height: 26px;\">(TestDTO&nbsp;testDTO)<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throws<\/span>&nbsp;Exception&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(testDTO.getNum()&nbsp;&lt;=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">0<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Exception(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u8f93\u5165\u7684\u6570\u5b57\u9700\u8981\u5927\u4e8e0\"<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(testDTO.getType().equals(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"square\"<\/span>))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Math.pow(testDTO.getNum(),&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">2<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(testDTO.getType().equals(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"factorial\"<\/span>))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">double<\/span>&nbsp;result&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">1<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">int<\/span>&nbsp;num&nbsp;=&nbsp;testDTO.getNum();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">while<\/span>&nbsp;(num&nbsp;&gt;&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">1<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;result&nbsp;*&nbsp;num;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;-=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">1<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;result;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Exception(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u672a\u8bc6\u522b\u7684\u7b97\u6cd5\"<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/Controller<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestController<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestController<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;TestService&nbsp;testService;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@PostMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/test\"<\/span>)<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Double&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">test<\/span><span style=\"outline: 0px;line-height: 26px;\">(@RequestBody&nbsp;TestDTO&nbsp;testDTO)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">try<\/span>&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Double&nbsp;result&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.testService.service(testDTO);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;result;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">catch<\/span>&nbsp;(Exception&nbsp;e)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;RuntimeException(e);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Autowired<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;DTOid&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">setTestService<\/span><span style=\"outline: 0px;line-height: 26px;\">(TestService&nbsp;testService)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.testService&nbsp;=&nbsp;testService;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5982\u679c\u771f\u7684\u6309\u7167\u4e0a\u9762\u6240\u5217\u7684\u5de5\u4f5c\u9879\u6765\u5f00\u53d1 Controller \u4ee3\u7801\u4f1a\u6709\u51e0\u4e2a\u95ee\u9898<\/p>\n<ol data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u53c2\u6570\u6821\u9a8c\u8fc7\u591a\u5730\u8026\u5408\u4e86\u4e1a\u52a1\u4ee3\u7801\uff0c\u8fdd\u80cc\u5355\u4e00\u804c\u8d23\u539f\u5219<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u53ef\u80fd\u5728\u591a\u4e2a\u4e1a\u52a1\u4e2d\u90fd\u629b\u51fa\u540c\u4e00\u4e2a\u5f02\u5e38\uff0c\u5bfc\u81f4\u4ee3\u7801\u91cd\u590d<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u5404\u79cd\u5f02\u5e38\u53cd\u9988\u548c\u6210\u529f\u54cd\u5e94\u683c\u5f0f\u4e0d\u7edf\u4e00\uff0c\u63a5\u53e3\u5bf9\u63a5\u4e0d\u53cb\u597d<\/section>\n<\/li>\n<\/ol>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1em;margin-bottom: 10px;outline: 0px;font-weight: bold;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;white-space: normal;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_png\/CKvMdchsUwkhJK4h7WQKWKAMrCbnicQrQLI7jMMPVAuZr3icop6VB9wQUAyKyAZCgbR5fnQljtU8VpoiaQ1HaiaG8g\/640?wx_fmt=png&quot;) center center \/ 50px no-repeat rgb(255, 255, 255);color: black;text-align: center;\"><span style=\"margin-top: 38px;margin-bottom: 10px;outline: 0px;display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;font-size: 18px;\">\u6539\u9020 Controller \u5c42\u903b\u8f91<\/span><\/h2>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1.2em;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 20px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\"><span style=\"margin-bottom: -1px;outline: 0px;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-size: 100% 100%;background-repeat: no-repeat;display: inline-block;width: 16px;height: 15px;line-height: 15px;\"><\/span><span style=\"margin-left: 8px;outline: 0px;font-size: 17px;display: inline-block;color: rgb(72, 179, 120);\">\u7edf\u4e00\u8fd4\u56de\u7ed3\u6784<\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u7edf\u4e00\u8fd4\u56de\u503c\u7c7b\u578b\u65e0\u8bba\u9879\u76ee\u524d\u540e\u7aef\u662f\u5426\u5206\u79bb\u90fd\u662f\u975e\u5e38\u5fc5\u8981\u7684\uff0c\u65b9\u4fbf\u5bf9\u63a5\u63a5\u53e3\u7684\u5f00\u53d1\u4eba\u5458\u66f4\u52a0\u6e05\u6670\u5730\u77e5\u9053\u8fd9\u4e2a\u63a5\u53e3\u7684\u8c03\u7528\u662f\u5426\u6210\u529f\uff08\u4e0d\u80fd\u4ec5\u4ec5\u7b80\u5355\u5730\u770b\u8fd4\u56de\u503c\u662f\u5426\u4e3a&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">null<\/code>&nbsp;\u5c31\u5224\u65ad\u6210\u529f\u4e0e\u5426\uff0c\u56e0\u4e3a\u6709\u4e9b\u63a5\u53e3\u7684\u8bbe\u8ba1\u5c31\u662f\u5982\u6b64\uff09\uff0c\u4f7f\u7528\u4e00\u4e2a\u72b6\u6001\u7801\u3001\u72b6\u6001\u4fe1\u606f\u5c31\u80fd\u6e05\u695a\u5730\u4e86\u89e3\u63a5\u53e3\u8c03\u7528\u60c5\u51b5<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5b9a\u4e49\u8fd4\u56de\u6570\u636e\u7ed3\u6784<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">interface<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">IResult<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">Integer&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">getCode<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span><\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">String&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">getMessage<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span><\/span>;<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5e38\u7528\u7ed3\u679c\u7684\u679a\u4e3e<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">enum<\/span>&nbsp;ResultEnum&nbsp;implements&nbsp;IResult&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;SUCCESS(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">2001<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u63a5\u53e3\u8c03\u7528\u6210\u529f\"<\/span>),<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;VALIDATE_FAILED(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">2002<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u53c2\u6570\u6821\u9a8c\u5931\u8d25\"<\/span>),<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;COMMON_FAILED(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">2003<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u63a5\u53e3\u8c03\u7528\u5931\u8d25\"<\/span>),<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;FORBIDDEN(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">2004<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u6ca1\u6709\u6743\u9650\u8bbf\u95ee\u8d44\u6e90\"<\/span>);<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;Integer&nbsp;code;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;message;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u7701\u7565get\u3001set\u65b9\u6cd5\u548c\u6784\u9020\u65b9\u6cd5<\/span><br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u7edf\u4e00\u8fd4\u56de\u6570\u636e\u7ed3\u6784<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Data<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@NoArgsConstructor<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@AllArgsConstructor<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">T<\/span>&gt;&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;Integer&nbsp;code;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;message;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;T&nbsp;data;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;&lt;T&gt;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">Result&lt;T&gt;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">success<\/span><span style=\"outline: 0px;line-height: 26px;\">(T&nbsp;data)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;(ResultEnum.SUCCESS.getCode(),&nbsp;ResultEnum.SUCCESS.getMessage(),&nbsp;data);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;&lt;T&gt;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">Result&lt;T&gt;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">success<\/span><span style=\"outline: 0px;line-height: 26px;\">(String&nbsp;message,&nbsp;T&nbsp;data)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;(ResultEnum.SUCCESS.getCode(),&nbsp;message,&nbsp;data);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;Result&lt;?&gt;&nbsp;failed()&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;(ResultEnum.COMMON_FAILED.getCode(),&nbsp;ResultEnum.COMMON_FAILED.getMessage(),&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;Result&lt;?&gt;&nbsp;failed(String&nbsp;message)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;(ResultEnum.COMMON_FAILED.getCode(),&nbsp;message,&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;Result&lt;?&gt;&nbsp;failed(IResult&nbsp;errorResult)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;(errorResult.getCode(),&nbsp;errorResult.getMessage(),&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">static<\/span>&nbsp;&lt;T&gt;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">Result&lt;T&gt;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">instance<\/span><span style=\"outline: 0px;line-height: 26px;\">(Integer&nbsp;code,&nbsp;String&nbsp;message,&nbsp;T&nbsp;data)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result&lt;T&gt;&nbsp;result&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;Result&lt;&gt;();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result.setCode(code);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result.setMessage(message);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result.setData(data);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;result;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u7edf\u4e00\u8fd4\u56de\u7ed3\u6784\u540e\uff0c\u5728 Controller \u4e2d\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e86\uff0c\u4f46\u662f\u6bcf\u4e00\u4e2a Controller \u90fd\u5199\u8fd9\u4e48\u4e00\u6bb5\u6700\u7ec8\u5c01\u88c5\u7684\u903b\u8f91\uff0c\u8fd9\u4e9b\u90fd\u662f\u5f88\u91cd\u590d\u7684\u5de5\u4f5c\uff0c\u6240\u4ee5\u8fd8\u8981\u7ee7\u7eed\u60f3\u529e\u6cd5\u8fdb\u4e00\u6b65\u5904\u7406\u7edf\u4e00\u8fd4\u56de\u7ed3\u6784<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1.2em;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 20px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\"><span style=\"margin-bottom: -1px;outline: 0px;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-size: 100% 100%;background-repeat: no-repeat;display: inline-block;width: 16px;height: 15px;line-height: 15px;\"><\/span><span style=\"margin-left: 8px;outline: 0px;font-size: 17px;display: inline-block;color: rgb(72, 179, 120);\">\u7edf\u4e00\u5305\u88c5\u5904\u7406<\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">Spring \u4e2d\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7c7b&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ResponseBodyAdvice<\/code>&nbsp;\uff0c\u80fd\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u4e0a\u8ff0\u9700\u6c42<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\"><code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ResponseBodyAdvice<\/code>&nbsp;\u662f\u5bf9 Controller \u8fd4\u56de\u7684\u5185\u5bb9\u5728&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">HttpMessageConverter<\/code>&nbsp;\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u4e4b\u524d\u62e6\u622a\uff0c\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u64cd\u4f5c\u540e\uff0c\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u90a3\u8fd9\u6837\u5c31\u53ef\u4ee5\u628a\u7edf\u4e00\u5305\u88c5\u7684\u5de5\u4f5c\u653e\u5230\u8fd9\u4e2a\u7c7b\u91cc\u9762\u3002<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">interface<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ResponseBodyAdvice<\/span>&lt;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">T<\/span>&gt;&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">supports<\/span><span style=\"outline: 0px;line-height: 26px;\">(MethodParameter&nbsp;returnType,&nbsp;Class&lt;?&nbsp;extends&nbsp;HttpMessageConverter&lt;?&gt;&gt;&nbsp;converterType)<\/span><\/span>;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Nullable<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">T&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">beforeBodyWrite<\/span><span style=\"outline: 0px;line-height: 26px;\">(@Nullable&nbsp;T&nbsp;body,&nbsp;MethodParameter&nbsp;returnType,&nbsp;MediaType&nbsp;selectedContentType,&nbsp;Class&lt;?&nbsp;extends&nbsp;HttpMessageConverter&lt;?&gt;&gt;&nbsp;selectedConverterType,&nbsp;ServerHttpRequest&nbsp;request,&nbsp;ServerHttpResponse&nbsp;response)<\/span><\/span>;<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">supports\uff1a\u5224\u65ad\u662f\u5426\u8981\u4ea4\u7ed9 beforeBodyWrite \u65b9\u6cd5\u6267\u884c\uff0cture\uff1a\u9700\u8981\uff1bfalse\uff1a\u4e0d\u9700\u8981<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">beforeBodyWrite\uff1a\u5bf9 response \u8fdb\u884c\u5177\u4f53\u7684\u5904\u7406<\/section>\n<\/li>\n<\/ul>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5982\u679c\u5f15\u5165\u4e86swagger\u6216knife4j\u7684\u6587\u6863\u751f\u6210\u7ec4\u4ef6\uff0c\u8fd9\u91cc\u9700\u8981\u4ec5\u626b\u63cf\u81ea\u5df1\u9879\u76ee\u7684\u5305\uff0c\u5426\u5219\u6587\u6863\u65e0\u6cd5\u6b63\u5e38\u751f\u6210<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestControllerAdvice<\/span>(basePackages&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"com.example.demo\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ResponseAdvice<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ResponseBodyAdvice<\/span>&lt;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Object<\/span>&gt;&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">supports<\/span><span style=\"outline: 0px;line-height: 26px;\">(MethodParameter&nbsp;returnType,&nbsp;Class&lt;?&nbsp;extends&nbsp;HttpMessageConverter&lt;?&gt;&gt;&nbsp;converterType)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5982\u679c\u4e0d\u9700\u8981\u8fdb\u884c\u5c01\u88c5\u7684\uff0c\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e9b\u6821\u9a8c\u624b\u6bb5\uff0c\u6bd4\u5982\u6dfb\u52a0\u6807\u8bb0\u6392\u9664\u7684\u6ce8\u89e3<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">true<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">beforeBodyWrite<\/span><span style=\"outline: 0px;line-height: 26px;\">(Object&nbsp;body,&nbsp;MethodParameter&nbsp;returnType,&nbsp;MediaType&nbsp;selectedContentType,&nbsp;Class&lt;?&nbsp;extends&nbsp;HttpMessageConverter&lt;?&gt;&gt;&nbsp;selectedConverterType,&nbsp;ServerHttpRequest&nbsp;request,&nbsp;ServerHttpResponse&nbsp;response)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u63d0\u4f9b\u4e00\u5b9a\u7684\u7075\u6d3b\u5ea6\uff0c\u5982\u679cbody\u5df2\u7ecf\u88ab\u5305\u88c5\u4e86\uff0c\u5c31\u4e0d\u8fdb\u884c\u5305\u88c5<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(body&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">instanceof<\/span>&nbsp;Result)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;body;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.success(body);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u7ecf\u8fc7\u8fd9\u6837\u6539\u9020\uff0c\u65e2\u80fd\u5b9e\u73b0\u5bf9 Controller \u8fd4\u56de\u7684\u6570\u636e\u8fdb\u884c\u7edf\u4e00\u5305\u88c5\uff0c\u53c8\u4e0d\u9700\u8981\u5bf9\u539f\u6709\u4ee3\u7801\u8fdb\u884c\u5927\u91cf\u7684\u6539\u52a8<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1.2em;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 20px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\"><span style=\"margin-bottom: -1px;outline: 0px;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-size: 100% 100%;background-repeat: no-repeat;display: inline-block;width: 16px;height: 15px;line-height: 15px;\"><\/span><span style=\"margin-left: 8px;outline: 0px;font-size: 17px;display: inline-block;color: rgb(72, 179, 120);\">\u5904\u7406 cannot be cast to java.lang.String \u95ee\u9898<\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5982\u679c\u76f4\u63a5\u4f7f\u7528&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ResponseBodyAdvice<\/code>\uff0c\u5bf9\u4e8e\u4e00\u822c\u7684\u7c7b\u578b\u90fd\u6ca1\u6709\u95ee\u9898\uff0c\u5f53\u5904\u7406\u5b57\u7b26\u4e32\u7c7b\u578b\u65f6\uff0c\u4f1a\u629b\u51fa&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">xxx.\u5305\u88c5\u7c7b cannot be cast to java.lang.String<\/code>&nbsp;\u7684\u7c7b\u578b\u8f6c\u6362\u7684\u5f02\u5e38<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ResponseBodyAdvice<\/code>&nbsp;\u5b9e\u73b0\u7c7b\u4e2d debug \u53d1\u73b0\uff0c\u53ea\u6709 String \u7c7b\u578b\u7684&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">selectedConverterType<\/code>&nbsp;\u53c2\u6570\u503c\u662f&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">org.springframework.http.converter.StringHttpMessageConverter<\/code>\uff0c\u800c\u5176\u4ed6\u6570\u636e\u7c7b\u578b\u7684\u503c\u662f&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">org.springframework.http.converter.json.MappingJackson2HttpMessageConverter<\/code><\/p>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">String \u7c7b\u578b<\/section>\n<\/li>\n<\/ul>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.2101851851851852\"  data-type=\"png\" data-w=\"1080\" style=\"margin-right: auto;margin-bottom: 25px;margin-left: auto;outline: 0px;display: block;border-radius: 4px;width: 677px !important;visibility: visible !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.2101851851851852\"  data-type=\"png\" data-w=\"1080\" style=\"margin-right: auto;margin-bottom: 25px;margin-left: auto;outline: 0px;display: block;border-radius: 4px;width: 677px !important;visibility: visible !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png\"  \/><\/noscript><\/figure>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u5176\u4ed6\u7c7b\u578b (\u5982 Integer \u7c7b\u578b)<\/section>\n<\/li>\n<\/ul>\n<figure data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);display: flex;flex-direction: column;justify-content: center;align-items: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-ratio=\"0.19166666666666668\"  data-type=\"png\" data-w=\"1080\" style=\"margin-right: auto;margin-bottom: 25px;margin-left: auto;outline: 0px;display: block;border-radius: 4px;width: 677px !important;visibility: visible !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010341821.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.19166666666666668\"  data-type=\"png\" data-w=\"1080\" style=\"margin-right: auto;margin-bottom: 25px;margin-left: auto;outline: 0px;display: block;border-radius: 4px;width: 677px !important;visibility: visible !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010341821.png\"  \/><\/noscript><\/figure>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u73b0\u5728\u95ee\u9898\u5df2\u7ecf\u8f83\u4e3a\u6e05\u6670\u4e86\uff0c\u56e0\u4e3a\u6211\u4eec\u9700\u8981\u8fd4\u56de\u4e00\u4e2a&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Result<\/code>&nbsp;\u5bf9\u8c61<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u6240\u4ee5\u4f7f\u7528&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MappingJackson2HttpMessageConverter<\/code>&nbsp;\u662f\u53ef\u4ee5\u6b63\u5e38\u8f6c\u6362\u7684<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u800c\u4f7f\u7528&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">StringHttpMessageConverter<\/code>&nbsp;\u5b57\u7b26\u4e32\u8f6c\u6362\u5668\u4f1a\u5bfc\u81f4\u7c7b\u578b\u8f6c\u6362\u5931\u8d25<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u73b0\u5728\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\u6709\u4e24\u79cd\u65b9\u5f0f<\/p>\n<ol data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u5728&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">beforeBodyWrite<\/code>&nbsp;\u65b9\u6cd5\u5904\u8fdb\u884c\u5224\u65ad\uff0c\u5982\u679c\u8fd4\u56de\u503c\u662f String \u7c7b\u578b\u5c31\u5bf9&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">Result<\/code>&nbsp;\u5bf9\u8c61\u624b\u52a8\u8fdb\u884c\u8f6c\u6362\u6210 JSON \u5b57\u7b26\u4e32\uff0c\u53e6\u5916\u65b9\u4fbf\u524d\u7aef\u4f7f\u7528\uff0c\u6700\u597d\u5728&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">@RequestMapping<\/code>&nbsp;\u4e2d\u6307\u5b9a ContentType<\/section>\n<\/li>\n<\/ol>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestControllerAdvice<\/span>(basePackages&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"com.example.demo\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ResponseAdvice<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ResponseBodyAdvice<\/span>&lt;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Object<\/span>&gt;&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;...<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">beforeBodyWrite<\/span><span style=\"outline: 0px;line-height: 26px;\">(Object&nbsp;body,&nbsp;MethodParameter&nbsp;returnType,&nbsp;MediaType&nbsp;selectedContentType,&nbsp;Class&lt;?&nbsp;extends&nbsp;HttpMessageConverter&lt;?&gt;&gt;&nbsp;selectedConverterType,&nbsp;ServerHttpRequest&nbsp;request,&nbsp;ServerHttpResponse&nbsp;response)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u63d0\u4f9b\u4e00\u5b9a\u7684\u7075\u6d3b\u5ea6\uff0c\u5982\u679cbody\u5df2\u7ecf\u88ab\u5305\u88c5\u4e86\uff0c\u5c31\u4e0d\u8fdb\u884c\u5305\u88c5<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(body&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">instanceof<\/span>&nbsp;Result)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;body;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u5982\u679c\u8fd4\u56de\u503c\u662fString\u7c7b\u578b\uff0c\u90a3\u5c31\u624b\u52a8\u628aResult\u5bf9\u8c61\u8f6c\u6362\u6210JSON\u5b57\u7b26\u4e32<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(body&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">instanceof<\/span>&nbsp;String)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">try<\/span>&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.objectMapper.writeValueAsString(Result.success(body));<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">catch<\/span>&nbsp;(JsonProcessingException&nbsp;e)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;RuntimeException(e);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.success(body);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;...<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@GetMapping<\/span>(value&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/returnString\"<\/span>,&nbsp;produces&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"application\/json;&nbsp;charset=UTF-8\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;String&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">returnString<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"success\"<\/span>;<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<ol start=\"2\" data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u4fee\u6539&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">HttpMessageConverter<\/code>&nbsp;\u5b9e\u4f8b\u96c6\u5408\u4e2d&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MappingJackson2HttpMessageConverter<\/code>&nbsp;\u7684\u987a\u5e8f\u3002\u56e0\u4e3a\u53d1\u751f\u4e0a\u8ff0\u95ee\u9898\u7684\u6839\u6e90\u6240\u5728\u662f\u96c6\u5408\u4e2d&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">StringHttpMessageConverter<\/code>&nbsp;\u7684\u987a\u5e8f\u5148\u4e8e&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MappingJackson2HttpMessageConverter<\/code>&nbsp;\u7684\uff0c\u8c03\u6574\u987a\u5e8f\u540e\u5373\u53ef\u4ece\u6839\u6e90\u4e0a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898<\/section>\n<\/li>\n<\/ol>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u7f51\u4e0a\u6709\u4e0d\u5c11\u505a\u6cd5\u662f\u76f4\u63a5\u5728\u96c6\u5408\u4e2d\u7b2c\u4e00\u4f4d\u6dfb\u52a0&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MappingJackson2HttpMessageConverter<\/code><\/section>\n<\/li>\n<\/ul>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Configuration<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">WebConfiguration<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">WebMvcConfigurer<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">configureMessageConverters<\/span><span style=\"outline: 0px;line-height: 26px;\">(List&lt;HttpMessageConverter&lt;?&gt;&gt;&nbsp;converters)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;converters.add(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">0<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;MappingJackson2HttpMessageConverter());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u8bda\u7136\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u89e3\u51b3\u95ee\u9898\uff0c\u4f46\u5176\u5b9e\u95ee\u9898\u7684\u6839\u6e90\u4e0d\u662f\u96c6\u5408\u4e2d\u7f3a\u5c11\u8fd9\u4e00\u4e2a\u8f6c\u6362\u5668\uff0c\u800c\u662f\u8f6c\u6362\u5668\u7684\u987a\u5e8f\u5bfc\u81f4\u7684\uff0c\u6240\u4ee5\u6700\u5408\u7406\u7684\u505a\u6cd5\u5e94\u8be5\u662f\u8c03\u6574&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MappingJackson2HttpMessageConverter<\/code>&nbsp;\u5728\u96c6\u5408\u4e2d\u7684\u987a\u5e8f<\/section>\n<\/li>\n<\/ul>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Configuration<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">WebMvcConfiguration<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">WebMvcConfigurer<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u4ea4\u6362MappingJackson2HttpMessageConverter\u4e0e\u7b2c\u4e00\u4f4d\u5143\u7d20<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u8ba9\u8fd4\u56de\u503c\u7c7b\u578b\u4e3aString\u7684\u63a5\u53e3\u80fd\u6b63\u5e38\u8fd4\u56de\u5305\u88c5\u7ed3\u679c<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;converters&nbsp;initially&nbsp;an&nbsp;empty&nbsp;list&nbsp;of&nbsp;converters<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">configureMessageConverters<\/span><span style=\"outline: 0px;line-height: 26px;\">(List&lt;HttpMessageConverter&lt;?&gt;&gt;&nbsp;converters)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">for<\/span>&nbsp;(<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">int<\/span>&nbsp;i&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">0<\/span>;&nbsp;i&nbsp;&lt;&nbsp;converters.size();&nbsp;i++)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(converters.get(i)&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">instanceof<\/span>&nbsp;MappingJackson2HttpMessageConverter)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MappingJackson2HttpMessageConverter&nbsp;mappingJackson2HttpMessageConverter&nbsp;=&nbsp;(MappingJackson2HttpMessageConverter)&nbsp;converters.get(i);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;converters.set(i,&nbsp;converters.get(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">0<\/span>));<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;converters.set(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">0<\/span>,&nbsp;mappingJackson2HttpMessageConverter);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">break<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1.2em;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 20px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\"><span style=\"margin-bottom: -1px;outline: 0px;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-size: 100% 100%;background-repeat: no-repeat;display: inline-block;width: 16px;height: 15px;line-height: 15px;\"><\/span><span style=\"margin-left: 8px;outline: 0px;font-size: 17px;display: inline-block;color: rgb(72, 179, 120);\">\u53c2\u6570\u6821\u9a8c<\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">Java API \u7684\u89c4\u8303&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">JSR303<\/code>&nbsp;\u5b9a\u4e49\u4e86\u6821\u9a8c\u7684\u6807\u51c6&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">validation-api<\/code>&nbsp;\uff0c\u5176\u4e2d\u4e00\u4e2a\u6bd4\u8f83\u51fa\u540d\u7684\u5b9e\u73b0\u662f&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">hibernate validation<\/code>&nbsp;\uff0c<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">spring validation<\/code>&nbsp;\u662f\u5bf9\u5176\u7684\u4e8c\u6b21\u5c01\u88c5\uff0c\u5e38\u7528\u4e8e SpringMVC \u7684\u53c2\u6570\u81ea\u52a8\u6821\u9a8c\uff0c\u53c2\u6570\u6821\u9a8c\u7684\u4ee3\u7801\u5c31\u4e0d\u9700\u8981\u518d\u4e0e\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u8fdb\u884c\u8026\u5408\u4e86<\/p>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 18px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">@PathVariable \u548c @RequestParam \u53c2\u6570\u6821\u9a8c<\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">Get \u8bf7\u6c42\u7684\u53c2\u6570\u63a5\u6536\u4e00\u822c\u4f9d\u8d56\u8fd9\u4e24\u4e2a\u6ce8\u89e3\uff0c\u4f46\u662f\u5904\u4e8e url \u6709\u957f\u5ea6\u9650\u5236\u548c\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\uff0c\u8d85\u8fc7 5 \u4e2a\u53c2\u6570\u5c3d\u91cf\u7528\u5b9e\u4f53\u6765\u4f20\u53c2<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5bf9 @PathVariable \u548c @RequestParam \u53c2\u6570\u8fdb\u884c\u6821\u9a8c\u9700\u8981\u5728\u5165\u53c2\u58f0\u660e\u7ea6\u675f\u7684\u6ce8\u89e3<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5982\u679c\u6821\u9a8c\u5931\u8d25\uff0c\u4f1a\u629b\u51fa&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MethodArgumentNotValidException<\/code>&nbsp;\u5f02\u5e38<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestController<\/span>(value&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"prettyTestController\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RequestMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/pretty\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Validated<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestController<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;TestService&nbsp;testService;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@GetMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/{num}\"<\/span>)<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Integer&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">detail<\/span><span style=\"outline: 0px;line-height: 26px;\">(@PathVariable(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"num\"<\/span>)<\/span>&nbsp;@<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">Min<\/span><span style=\"outline: 0px;line-height: 26px;\">(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">1<\/span>)<\/span>&nbsp;@<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">Max<\/span><span style=\"outline: 0px;line-height: 26px;\">(<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">20<\/span>)<\/span>&nbsp;Integer&nbsp;num)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;num&nbsp;*&nbsp;num;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@GetMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/getByEmail\"<\/span>)<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;TestDTO&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">getByAccount<\/span><span style=\"outline: 0px;line-height: 26px;\">(@RequestParam&nbsp;@NotBlank&nbsp;@Email&nbsp;String&nbsp;email)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TestDTO&nbsp;testDTO&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;TestDTO();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testDTO.setEmail(email);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;testDTO;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Autowired<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">setTestService<\/span><span style=\"outline: 0px;line-height: 26px;\">(TestService&nbsp;prettyTestService)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.testService&nbsp;=&nbsp;prettyTestService;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 18px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\u6821\u9a8c\u539f\u7406<\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5728 SpringMVC \u4e2d\uff0c\u6709\u4e00\u4e2a\u7c7b\u662f&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">RequestResponseBodyMethodProcessor<\/code>&nbsp;\uff0c\u8fd9\u4e2a\u7c7b\u6709\u4e24\u4e2a\u4f5c\u7528\uff08\u5b9e\u9645\u4e0a\u53ef\u4ee5\u4ece\u540d\u5b57\u4e0a\u5f97\u5230\u4e00\u70b9\u542f\u53d1\uff09<\/p>\n<ol data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u7528\u4e8e\u89e3\u6790 @RequestBody \u6807\u6ce8\u7684\u53c2\u6570<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u5904\u7406 @ResponseBody \u6807\u6ce8\u65b9\u6cd5\u7684\u8fd4\u56de\u503c<\/section>\n<\/li>\n<\/ol>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u89e3\u6790 @RequestBoyd \u6807\u6ce8\u53c2\u6570\u7684\u65b9\u6cd5\u662f&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">resolveArgument<\/code><\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">RequestResponseBodyMethodProcessor<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">extends<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">AbstractMessageConverterMethodProcessor<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Throws&nbsp;MethodArgumentNotValidException&nbsp;if&nbsp;validation&nbsp;fails.<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@throws<\/span>&nbsp;HttpMessageNotReadableException&nbsp;if&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@link<\/span>&nbsp;RequestBody#required()}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;is&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;true}&nbsp;and&nbsp;there&nbsp;is&nbsp;no&nbsp;body&nbsp;content&nbsp;or&nbsp;if&nbsp;there&nbsp;is&nbsp;no&nbsp;suitable<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;converter&nbsp;to&nbsp;read&nbsp;the&nbsp;content&nbsp;with.<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">resolveArgument<\/span><span style=\"outline: 0px;line-height: 26px;\">(MethodParameter&nbsp;parameter,&nbsp;@Nullable&nbsp;ModelAndViewContainer&nbsp;mavContainer,<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NativeWebRequest&nbsp;webRequest,&nbsp;@Nullable&nbsp;WebDataBinderFactory&nbsp;binderFactory)<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throws<\/span>&nbsp;Exception&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parameter&nbsp;=&nbsp;parameter.nestedIfOptional();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u628a\u8bf7\u6c42\u6570\u636e\u5c01\u88c5\u6210\u6807\u6ce8\u7684DTO\u5bf9\u8c61<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;arg&nbsp;=&nbsp;readWithMessageConverters(webRequest,&nbsp;parameter,&nbsp;parameter.getNestedGenericParameterType());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;name&nbsp;=&nbsp;Conventions.getVariableNameForParameter(parameter);<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(binderFactory&nbsp;!=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WebDataBinder&nbsp;binder&nbsp;=&nbsp;binderFactory.createBinder(webRequest,&nbsp;arg,&nbsp;name);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(arg&nbsp;!=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6267\u884c\u6570\u636e\u6821\u9a8c<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;validateIfApplicable(binder,&nbsp;parameter);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5982\u679c\u6821\u9a8c\u4e0d\u901a\u8fc7\uff0c\u5c31\u629b\u51faMethodArgumentNotValidException\u5f02\u5e38<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5982\u679c\u6211\u4eec\u4e0d\u81ea\u5df1\u6355\u83b7\uff0c\u90a3\u4e48\u6700\u7ec8\u4f1a\u7531DefaultHandlerExceptionResolver\u6355\u83b7\u5904\u7406<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(binder.getBindingResult().hasErrors()&nbsp;&amp;&amp;&nbsp;isBindExceptionRequired(binder,&nbsp;parameter))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;MethodArgumentNotValidException(parameter,&nbsp;binder.getBindingResult());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(mavContainer&nbsp;!=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mavContainer.addAttribute(BindingResult.MODEL_KEY_PREFIX&nbsp;+&nbsp;name,&nbsp;binder.getBindingResult());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;adaptArgumentIfNecessary(arg,&nbsp;parameter);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">abstract<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">AbstractMessageConverterMethodArgumentResolver<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">HandlerMethodArgumentResolver<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Validate&nbsp;the&nbsp;binding&nbsp;target&nbsp;if&nbsp;applicable.<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;p&gt;The&nbsp;default&nbsp;implementation&nbsp;checks&nbsp;for&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@javax<\/span>.validation.Valid},<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Spring's&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@link<\/span>&nbsp;org.springframework.validation.annotation.Validated},<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;and&nbsp;custom&nbsp;annotations&nbsp;whose&nbsp;name&nbsp;starts&nbsp;with&nbsp;\"Valid\".<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;binder&nbsp;the&nbsp;DataBinder&nbsp;to&nbsp;be&nbsp;used<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;parameter&nbsp;the&nbsp;method&nbsp;parameter&nbsp;descriptor<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@since<\/span>&nbsp;4.1.5<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@see<\/span>&nbsp;#isBindExceptionRequired<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">protected<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">validateIfApplicable<\/span><span style=\"outline: 0px;line-height: 26px;\">(WebDataBinder&nbsp;binder,&nbsp;MethodParameter&nbsp;parameter)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u83b7\u53d6\u53c2\u6570\u4e0a\u7684\u6240\u6709\u6ce8\u89e3<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Annotation[]&nbsp;annotations&nbsp;=&nbsp;parameter.getParameterAnnotations();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">for<\/span>&nbsp;(Annotation&nbsp;ann&nbsp;:&nbsp;annotations)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5982\u679c\u6ce8\u89e3\u4e2d\u5305\u542b\u4e86@Valid\u3001@Validated\u6216\u8005\u662f\u540d\u5b57\u4ee5Valid\u5f00\u5934\u7684\u6ce8\u89e3\u5c31\u8fdb\u884c\u53c2\u6570\u6821\u9a8c<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object[]&nbsp;validationHints&nbsp;=&nbsp;ValidationAnnotationUtils.determineValidationHints(ann);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(validationHints&nbsp;!=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u5b9e\u9645\u6821\u9a8c\u903b\u8f91\uff0c\u6700\u7ec8\u4f1a\u8c03\u7528Hibernate&nbsp;Validator\u6267\u884c\u771f\u6b63\u7684\u6821\u9a8c<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6240\u4ee5Spring&nbsp;Validation\u662f\u5bf9Hibernate&nbsp;Validation\u7684\u4e8c\u6b21\u5c01\u88c5<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;binder.validate(validationHints);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">break<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 18px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">@RequestBody \u53c2\u6570\u6821\u9a8c<\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">Post\u3001Put \u8bf7\u6c42\u7684\u53c2\u6570\u63a8\u8350\u4f7f\u7528 @RequestBody \u8bf7\u6c42\u4f53\u53c2\u6570<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5bf9 @RequestBody \u53c2\u6570\u8fdb\u884c\u6821\u9a8c\u9700\u8981\u5728 DTO \u5bf9\u8c61\u4e2d\u52a0\u5165\u6821\u9a8c\u6761\u4ef6\u540e\uff0c\u518d\u642d\u914d @Validated \u5373\u53ef\u5b8c\u6210\u81ea\u52a8\u6821\u9a8c<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u5982\u679c\u6821\u9a8c\u5931\u8d25\uff0c\u4f1a\u629b\u51fa&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">ConstraintViolationException<\/code>&nbsp;\u5f02\u5e38<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/DTO<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Data<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestDTO<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@NotBlank<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;userName;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@NotBlank<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Length<\/span>(min&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">6<\/span>,&nbsp;max&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(209, 154, 102);line-height: 26px;\">20<\/span>)<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;password;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@NotNull<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Email<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;String&nbsp;email;<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/Controller<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestController<\/span>(value&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"prettyTestController\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RequestMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/pretty\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">TestController<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;TestService&nbsp;testService;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@PostMapping<\/span>(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\/test-validation\"<\/span>)<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">testValidation<\/span><span style=\"outline: 0px;line-height: 26px;\">(@RequestBody&nbsp;@Validated&nbsp;TestDTO&nbsp;testDTO)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.testService.save(testDTO);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Autowired<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">setTestService<\/span><span style=\"outline: 0px;line-height: 26px;\">(TestService&nbsp;testService)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.testService&nbsp;=&nbsp;testService;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 18px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\u6821\u9a8c\u539f\u7406<\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u58f0\u660e\u7ea6\u675f\u7684\u65b9\u5f0f\uff0c\u6ce8\u89e3\u52a0\u5230\u4e86\u53c2\u6570\u4e0a\u9762\uff0c\u53ef\u4ee5\u6bd4\u8f83\u5bb9\u6613\u731c\u6d4b\u5230\u662f\u4f7f\u7528\u4e86 AOP \u5bf9\u65b9\u6cd5\u8fdb\u884c\u589e\u5f3a<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u800c\u5b9e\u9645\u4e0a Spring \u4e5f\u662f\u901a\u8fc7&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MethodValidationPostProcessor<\/code>&nbsp;\u52a8\u6001\u6ce8\u518c AOP \u5207\u9762\uff0c\u7136\u540e\u4f7f\u7528&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">MethodValidationInterceptor<\/code>&nbsp;\u5bf9\u5207\u70b9\u65b9\u6cd5\u8fdb\u884c\u7ec7\u5165\u589e\u5f3a<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">MethodValidationPostProcessor<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">extends<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">AbstractBeanFactoryAwareAdvisingPostProcessor<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">InitializingBean<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6307\u5b9a\u4e86\u521b\u5efa\u5207\u9762\u7684Bean\u7684\u6ce8\u89e3<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;Class&lt;?&nbsp;extends&nbsp;Annotation&gt;&nbsp;validatedAnnotationType&nbsp;=&nbsp;Validated<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span><\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">afterPropertiesSet<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u4e3a\u6240\u6709@Validated\u6807\u6ce8\u7684Bean\u521b\u5efa\u5207\u9762<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pointcut&nbsp;pointcut&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;AnnotationMatchingPointcut(<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.validatedAnnotationType,&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">true<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u521b\u5efaAdvisor\u8fdb\u884c\u589e\u5f3a<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.advisor&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;DefaultPointcutAdvisor(pointcut,&nbsp;createMethodValidationAdvice(<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.validator));<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u521b\u5efaAdvice\uff0c\u672c\u8d28\u5c31\u662f\u4e00\u4e2a\u65b9\u6cd5\u62e6\u622a\u5668<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">protected<\/span>&nbsp;Advice&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">createMethodValidationAdvice<\/span><span style=\"outline: 0px;line-height: 26px;\">(@Nullable&nbsp;Validator&nbsp;validator)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;(validator&nbsp;!=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">null<\/span>&nbsp;?&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;MethodValidationInterceptor(validator)&nbsp;:&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;MethodValidationInterceptor());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">MethodValidationInterceptor<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">MethodInterceptor<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;Object&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">invoke<\/span><span style=\"outline: 0px;line-height: 26px;\">(MethodInvocation&nbsp;invocation)<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throws<\/span>&nbsp;Throwable&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u65e0\u9700\u589e\u5f3a\u7684\u65b9\u6cd5\uff0c\u76f4\u63a5\u8df3\u8fc7<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(isFactoryBeanMetadataMethod(invocation.getMethod()))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;invocation.proceed();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;[]&nbsp;groups&nbsp;=&nbsp;determineValidationGroups(invocation);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecutableValidator&nbsp;execVal&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.validator.forExecutables();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;methodToValidate&nbsp;=&nbsp;invocation.getMethod();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set&lt;ConstraintViolation&lt;Object&gt;&gt;&nbsp;result;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">try<\/span>&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u65b9\u6cd5\u5165\u53c2\u6821\u9a8c\uff0c\u6700\u7ec8\u8fd8\u662f\u59d4\u6258\u7ed9Hibernate&nbsp;Validator\u6765\u6821\u9a8c<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6240\u4ee5Spring&nbsp;Validation\u662f\u5bf9Hibernate&nbsp;Validation\u7684\u4e8c\u6b21\u5c01\u88c5<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;execVal.validateParameters(<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invocation.getThis(),&nbsp;methodToValidate,&nbsp;invocation.getArguments(),&nbsp;groups);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">catch<\/span>&nbsp;(IllegalArgumentException&nbsp;ex)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6821\u9a8c\u4e0d\u901a\u8fc7\u629b\u51faConstraintViolationException\u5f02\u5e38<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(!result.isEmpty())&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;ConstraintViolationException(result);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/Controller\u65b9\u6cd5\u8c03\u7528<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;returnValue&nbsp;=&nbsp;invocation.proceed();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u4e0b\u9762\u662f\u5bf9\u8fd4\u56de\u503c\u505a\u6821\u9a8c\uff0c\u6d41\u7a0b\u548c\u4e0a\u9762\u5927\u6982\u4e00\u6837<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;execVal.validateReturnValue(invocation.getThis(),&nbsp;methodToValidate,&nbsp;returnValue,&nbsp;groups);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(!result.isEmpty())&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">throw<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;ConstraintViolationException(result);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;returnValue;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h4 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 30px;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 18px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219<\/h4>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u6709\u4e9b\u65f6\u5019&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">JSR303<\/code>&nbsp;\u6807\u51c6\u4e2d\u63d0\u4f9b\u7684\u6821\u9a8c\u89c4\u5219\u4e0d\u6ee1\u8db3\u590d\u6742\u7684\u4e1a\u52a1\u9700\u6c42\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219\u9700\u8981\u505a\u4e24\u4ef6\u4e8b\u60c5<\/p>\n<ol data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u81ea\u5b9a\u4e49\u6ce8\u89e3\u7c7b\uff0c\u5b9a\u4e49\u9519\u8bef\u4fe1\u606f\u548c\u4e00\u4e9b\u5176\u4ed6\u9700\u8981\u7684\u5185\u5bb9<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u6ce8\u89e3\u6821\u9a8c\u5668\uff0c\u5b9a\u4e49\u5224\u5b9a\u89c4\u5219<\/section>\n<\/li>\n<\/ol>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u81ea\u5b9a\u4e49\u6ce8\u89e3\u7c7b<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Target<\/span>({ElementType.METHOD,&nbsp;ElementType.FIELD,&nbsp;ElementType.ANNOTATION_TYPE,&nbsp;ElementType.CONSTRUCTOR,&nbsp;ElementType.PARAMETER})<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Retention<\/span>(RetentionPolicy.RUNTIME)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Documented<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Constraint<\/span>(validatedBy&nbsp;=&nbsp;MobileValidator<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;@<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">interface<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Mobile<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u662f\u5426\u5141\u8bb8\u4e3a\u7a7a<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">required<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">default<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">true<\/span><\/span>;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u6821\u9a8c\u4e0d\u901a\u8fc7\u8fd4\u56de\u7684\u63d0\u793a\u4fe1\u606f<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\">String&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">message<\/span><span style=\"outline: 0px;line-height: 26px;\">()<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">default<\/span>&nbsp;\"\u4e0d\u662f\u4e00\u4e2a\u624b\u673a\u53f7\u7801\u683c\u5f0f\"<\/span>;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Constraint\u8981\u6c42\u7684\u5c5e\u6027\uff0c\u7528\u4e8e\u5206\u7ec4\u6821\u9a8c\u548c\u6269\u5c55\uff0c\u7559\u7a7a\u5c31\u597d<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&gt;[]&nbsp;groups()&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">default<\/span>&nbsp;{};<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;Class&lt;?&nbsp;extends&nbsp;Payload&gt;[]&nbsp;payload()&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">default<\/span>&nbsp;{};<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u6ce8\u89e3\u6821\u9a8c\u5668<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">MobileValidator<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">implements<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ConstraintValidator<\/span>&lt;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Mobile<\/span>,&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">CharSequence<\/span>&gt;&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;required&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">false<\/span>;<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">final<\/span>&nbsp;Pattern&nbsp;pattern&nbsp;=&nbsp;Pattern.compile(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"^1[34578][0-9]{9}$\"<\/span>);&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u9a8c\u8bc1\u624b\u673a\u53f7<\/span><br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u5728\u9a8c\u8bc1\u5f00\u59cb\u524d\u8c03\u7528\u6ce8\u89e3\u91cc\u7684\u65b9\u6cd5\uff0c\u4ece\u800c\u83b7\u53d6\u5230\u4e00\u4e9b\u6ce8\u89e3\u91cc\u7684\u53c2\u6570<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;constraintAnnotation&nbsp;annotation&nbsp;instance&nbsp;for&nbsp;a&nbsp;given&nbsp;constraint&nbsp;declaration<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">void<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">initialize<\/span><span style=\"outline: 0px;line-height: 26px;\">(Mobile&nbsp;constraintAnnotation)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.required&nbsp;=&nbsp;constraintAnnotation.required();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u5224\u65ad\u53c2\u6570\u662f\u5426\u5408\u6cd5<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;value&nbsp;&nbsp;&nbsp;object&nbsp;to&nbsp;validate<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@param<\/span>&nbsp;context&nbsp;context&nbsp;in&nbsp;which&nbsp;the&nbsp;constraint&nbsp;is&nbsp;evaluated<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@Override<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">isValid<\/span><span style=\"outline: 0px;line-height: 26px;\">(CharSequence&nbsp;value,&nbsp;ConstraintValidatorContext&nbsp;context)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">this<\/span>.required)&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u9a8c\u8bc1<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;isMobile(value);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(StringUtils.hasText(value))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/&nbsp;\u9a8c\u8bc1<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;isMobile(value);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">true<\/span>;<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">private<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">boolean<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">isMobile<\/span><span style=\"outline: 0px;line-height: 26px;\">(<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">final<\/span>&nbsp;CharSequence&nbsp;str)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Matcher&nbsp;m&nbsp;=&nbsp;pattern.matcher(str);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;m.matches();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u81ea\u52a8\u6821\u9a8c\u53c2\u6570\u771f\u7684\u662f\u4e00\u9879\u975e\u5e38\u5fc5\u8981\u3001\u975e\u5e38\u6709\u610f\u4e49\u7684\u5de5\u4f5c\u3002&nbsp;<code style=\"margin-right: 2px;margin-left: 2px;padding: 2px 4px;outline: 0px;font-size: 14px;border-radius: 4px;background-color: rgba(27, 31, 35, 0.05);font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(40, 202, 113);\">JSR303<\/code>&nbsp;\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u53c2\u6570\u6821\u9a8c\u89c4\u5219\uff0c\u518d\u52a0\u4e0a\u590d\u6742\u4e1a\u52a1\u7684\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219\uff0c\u5b8c\u5168\u628a\u53c2\u6570\u6821\u9a8c\u548c\u4e1a\u52a1\u903b\u8f91\u89e3\u8026\u5f00\uff0c\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\uff0c\u7b26\u5408\u5355\u4e00\u804c\u8d23\u539f\u5219\u3002<\/p>\n<h3 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1.2em;margin-bottom: 15px;outline: 0px;font-weight: bold;font-size: 20px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\"><span style=\"margin-bottom: -1px;outline: 0px;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-size: 100% 100%;background-repeat: no-repeat;display: inline-block;width: 16px;height: 15px;line-height: 15px;\"><\/span><span style=\"margin-left: 8px;outline: 0px;font-size: 17px;display: inline-block;color: rgb(72, 179, 120);\">\u81ea\u5b9a\u4e49\u5f02\u5e38\u4e0e\u7edf\u4e00\u62e6\u622a\u5f02\u5e38<\/span><\/h3>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u539f\u6765\u7684\u4ee3\u7801\u4e2d\u53ef\u4ee5\u770b\u5230\u6709\u51e0\u4e2a\u95ee\u9898<\/p>\n<ol data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: black;\">\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u629b\u51fa\u7684\u5f02\u5e38\u4e0d\u591f\u5177\u4f53\uff0c\u53ea\u662f\u7b80\u5355\u5730\u628a\u9519\u8bef\u4fe1\u606f\u653e\u5230\u4e86 Exception \u4e2d<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u629b\u51fa\u5f02\u5e38\u540e\uff0cController \u4e0d\u80fd\u5177\u4f53\u5730\u6839\u636e\u5f02\u5e38\u505a\u51fa\u53cd\u9988<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\">\u867d\u7136\u505a\u4e86\u53c2\u6570\u81ea\u52a8\u6821\u9a8c\uff0c\u4f46\u662f\u5f02\u5e38\u8fd4\u56de\u7ed3\u6784\u548c\u6b63\u5e38\u8fd4\u56de\u7ed3\u6784\u4e0d\u4e00\u81f4<\/section>\n<\/li>\n<\/ol>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u81ea\u5b9a\u4e49\u5f02\u5e38\u662f\u4e3a\u4e86\u540e\u9762\u7edf\u4e00\u62e6\u622a\u5f02\u5e38\u65f6\uff0c\u5bf9\u4e1a\u52a1\u4e2d\u7684\u5f02\u5e38\u6709\u66f4\u52a0\u7ec6\u9897\u7c92\u5ea6\u7684\u533a\u5206\uff0c\u62e6\u622a\u65f6\u9488\u5bf9\u4e0d\u540c\u7684\u5f02\u5e38\u4f5c\u51fa\u4e0d\u540c\u7684\u54cd\u5e94<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u800c\u7edf\u4e00\u62e6\u622a\u5f02\u5e38\u7684\u76ee\u7684\u4e00\u4e2a\u662f\u4e3a\u4e86\u53ef\u4ee5\u4e0e\u524d\u9762\u5b9a\u4e49\u4e0b\u6765\u7684\u7edf\u4e00\u5305\u88c5\u8fd4\u56de\u7ed3\u6784\u80fd\u5bf9\u5e94\u4e0a\uff0c\u53e6\u4e00\u4e2a\u662f\u6211\u4eec\u5e0c\u671b\u65e0\u8bba\u7cfb\u7edf\u53d1\u751f\u4ec0\u4e48\u5f02\u5e38\uff0cHttp \u7684\u72b6\u6001\u7801\u90fd\u8981\u662f 200 \uff0c\u5c3d\u53ef\u80fd\u7531\u4e1a\u52a1\u6765\u533a\u5206\u7cfb\u7edf\u7684\u5f02\u5e38<\/p>\n<pre data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 10px;margin-bottom: 10px;outline: 0px;color: rgb(63, 63, 63);font-size: 16px;letter-spacing: 0.544px;text-align: left;background-color: rgb(255, 255, 255);\"><code style=\"padding: 16px;outline: 0px;overflow-x: auto;color: rgb(171, 178, 191);background: rgb(40, 44, 52);display: -webkit-box;font-family: &quot;Operator Mono&quot;, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;\"><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u81ea\u5b9a\u4e49\u5f02\u5e38<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ForbiddenException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">extends<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">RuntimeException<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">ForbiddenException<\/span><span style=\"outline: 0px;line-height: 26px;\">(String&nbsp;message)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">super<\/span>(message);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u81ea\u5b9a\u4e49\u5f02\u5e38<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">BusinessException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">extends<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">RuntimeException<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">BusinessException<\/span><span style=\"outline: 0px;line-height: 26px;\">(String&nbsp;message)<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">super<\/span>(message);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/\/\u7edf\u4e00\u62e6\u622a\u5f02\u5e38<\/span><br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@RestControllerAdvice<\/span>(basePackages&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"com.example.demo\"<\/span>)<br style=\"outline: 0px;\"  \/><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;line-height: 26px;\"><span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ExceptionAdvice<\/span>&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u6355\u83b7&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;BusinessException}&nbsp;\u5f02\u5e38<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@ExceptionHandler<\/span>({BusinessException<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>})<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;?&gt;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">handleBusinessException<\/span>(<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">BusinessException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ex<\/span>)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ex.getMessage());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u6355\u83b7&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;ForbiddenException}&nbsp;\u5f02\u5e38<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@ExceptionHandler<\/span>({ForbiddenException<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>})<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;?&gt;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">handleForbiddenException<\/span>(<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ForbiddenException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ex<\/span>)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ResultEnum.FORBIDDEN);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@RequestBody<\/span>}&nbsp;\u53c2\u6570\u6821\u9a8c\u4e0d\u901a\u8fc7\u65f6\u629b\u51fa\u7684\u5f02\u5e38\u5904\u7406<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@ExceptionHandler<\/span>({MethodArgumentNotValidException<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>})<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;?&gt;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">handleMethodArgumentNotValidException<\/span>(<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">MethodArgumentNotValidException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ex<\/span>)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BindingResult&nbsp;bindingResult&nbsp;=&nbsp;ex.getBindingResult();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StringBuilder&nbsp;sb&nbsp;=&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">new<\/span>&nbsp;StringBuilder(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\u6821\u9a8c\u5931\u8d25:\"<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">for<\/span>&nbsp;(FieldError&nbsp;fieldError&nbsp;:&nbsp;bindingResult.getFieldErrors())&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sb.append(fieldError.getField()).append(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\"\uff1a\"<\/span>).append(fieldError.getDefaultMessage()).append(<span style=\"outline: 0px;color: rgb(152, 195, 121);line-height: 26px;\">\",&nbsp;\"<\/span>);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;msg&nbsp;=&nbsp;sb.toString();<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(StringUtils.hasText(msg))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ResultEnum.VALIDATE_FAILED.getCode(),&nbsp;msg);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ResultEnum.VALIDATE_FAILED);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@PathVariable<\/span>}&nbsp;\u548c&nbsp;{<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@code<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">@RequestParam<\/span>}&nbsp;\u53c2\u6570\u6821\u9a8c\u4e0d\u901a\u8fc7\u65f6\u629b\u51fa\u7684\u5f02\u5e38\u5904\u7406<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@ExceptionHandler<\/span>({ConstraintViolationException<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>})<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;?&gt;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">handleConstraintViolationException<\/span>(<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ConstraintViolationException<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ex<\/span>)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">if<\/span>&nbsp;(StringUtils.hasText(ex.getMessage()))&nbsp;{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ResultEnum.VALIDATE_FAILED.getCode(),&nbsp;ex.getMessage());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ResultEnum.VALIDATE_FAILED);<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;\">\/**<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\u9876\u7ea7\u5f02\u5e38\u6355\u83b7\u5e76\u7edf\u4e00\u5904\u7406\uff0c\u5f53\u5176\u4ed6\u5f02\u5e38\u65e0\u6cd5\u5904\u7406\u65f6\u5019\u9009\u62e9\u4f7f\u7528<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<\/span><br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(97, 174, 238);line-height: 26px;\">@ExceptionHandler<\/span>({Exception<span style=\"outline: 0px;line-height: 26px;\">.<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">class<\/span>})<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">public<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Result<\/span>&lt;?&gt;&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">handle<\/span>(<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">Exception<\/span>&nbsp;<span style=\"outline: 0px;color: rgb(230, 192, 123);line-height: 26px;\">ex<\/span>)&nbsp;<\/span>{<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"outline: 0px;color: rgb(198, 120, 221);line-height: 26px;\">return<\/span>&nbsp;Result.failed(ex.getMessage());<br style=\"outline: 0px;\"  \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br style=\"outline: 0px;\"  \/><br style=\"outline: 0px;\"  \/>}<br style=\"outline: 0px;\"  \/><\/code><\/pre>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1em;margin-bottom: 10px;outline: 0px;font-weight: bold;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;letter-spacing: 0.544px;white-space: normal;background: url(&quot;https:\/\/mmbiz.qpic.cn\/mmbiz_png\/CKvMdchsUwkhJK4h7WQKWKAMrCbnicQrQLI7jMMPVAuZr3icop6VB9wQUAyKyAZCgbR5fnQljtU8VpoiaQ1HaiaG8g\/640?wx_fmt=png&quot;) center center \/ 50px no-repeat rgb(255, 255, 255);color: black;text-align: center;\"><span style=\"margin-top: 38px;margin-bottom: 10px;outline: 0px;display: inline-block;height: 38px;line-height: 42px;color: rgb(72, 179, 120);background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;font-size: 18px;\">\u603b\u7ed3<\/span><\/h2>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u505a\u597d\u4e86\u8fd9\u4e00\u5207\u6539\u52a8\u540e\uff0c\u53ef\u4ee5\u53d1\u73b0 Controller \u7684\u4ee3\u7801\u53d8\u5f97\u975e\u5e38\u7b80\u6d01\uff0c\u53ef\u4ee5\u5f88\u6e05\u695a\u5730\u77e5\u9053\u6bcf\u4e00\u4e2a\u53c2\u6570\u3001\u6bcf\u4e00\u4e2a DTO \u7684\u6821\u9a8c\u89c4\u5219\uff0c\u53ef\u4ee5\u5f88\u660e\u786e\u5730\u770b\u5230\u6bcf\u4e00\u4e2a Controller \u65b9\u6cd5\u8fd4\u56de\u7684\u662f\u4ec0\u4e48\u6570\u636e\uff0c\u4e5f\u53ef\u4ee5\u65b9\u4fbf\u6bcf\u4e00\u4e2a\u5f02\u5e38\u5e94\u8be5\u5982\u4f55\u8fdb\u884c\u53cd\u9988<\/p>\n<p data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-bottom: 0px;padding-top: 1em;padding-bottom: 8px;outline: 0px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;font-size: 16px;letter-spacing: 0.544px;text-align: left;white-space: normal;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);line-height: 1.75em;\">\u8fd9\u4e00\u5957\u64cd\u4f5c\u4e0b\u6765\u540e\uff0c\u6211\u4eec\u80fd\u66f4\u52a0\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u903b\u8f91\u7684\u5f00\u53d1\uff0c\u4ee3\u7801\u7b80\u6d01\u3001\u529f\u80fd\u5b8c\u5584\uff0c\u4f55\u4e50\u800c\u4e0d\u4e3a\u5462\uff1f<\/p>\n<p><br  \/><\/p>\n<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" style=\"padding-right: 10px;padding-left: 10px;outline: 0px;letter-spacing: 0.034em;white-space: normal;background-color: rgb(255, 255, 255);text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;line-height: 1.6;color: rgb(63, 63, 63);font-size: 16px;margin-bottom: 0px;\">\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"margin-top: 1em;margin-bottom: 10px;outline: 0px;font-weight: bold;font-size: 22px;color: black;text-align: center;background-image: url('https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010338734.png');background-position: center center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 50px;\"><span style=\"margin-top: 38px;margin-bottom: 10px;outline: 0px;display: inline-block;height: 38px;line-height: 42px;color: #48b378;background-position: left center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;background-size: 63px;font-size: 18px;\">\u63a8\u8350\u9605\u8bfb<\/span><\/h2>\n<ul data-tool=\"mdnice\u7f16\u8f91\u5668\" class=\"list-paddingleft-1\" style=\"margin-top: 8px;margin-bottom: 8px;padding-left: 25px;outline: 0px;color: black;\">\n<li style=\"outline: 0px;color: rgb(72, 179, 120);font-weight: bold;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzI1ODI1ODkzMA==&amp;mid=2247492045&amp;idx=1&amp;sn=2a10264d4767912fde725dd61cd52272&amp;chksm=ea084350dd7fca4672d032a2d34fb27df04c31d3be6e0d24e624845b3438749a2bb271a84165&amp;scene=21#wechat_redirect\" textvalue=\"\u6700\u8fd1\u706b\u8d77\u7684 Bean Searcher \u4e0e MyBatis Plus \u5230\u5e95\u6709\u5565\u533a\u522b\uff1f\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" style=\"text-decoration: underline;color: rgb(72, 179, 120);\" data-linktype=\"2\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"color: rgb(72, 179, 120);\"><strong>\u6700\u8fd1\u706b\u8d77\u7684 Bean Searcher \u4e0e MyBatis Plus \u5230\u5e95\u6709\u5565\u533a\u522b\uff1f<\/strong><\/span><\/a><\/section>\n<\/li>\n<li style=\"outline: 0px;color: rgb(72, 179, 120);font-weight: bold;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzI1ODI1ODkzMA==&amp;mid=2247491909&amp;idx=1&amp;sn=3efa29fa03e5a50223ee3c283b8cd9c3&amp;chksm=ea0843d8dd7fcace8375cf1f6e03943a0c0c9d70f949751e3c9a998430246a26246e652b6b8a&amp;scene=21#wechat_redirect\" textvalue=\"\u7a0b\u5e8f\u5458:\u6709\u54ea\u4e9b\u8bdd\u4e00\u542c\u5c31\u77e5\u9053\u5bf9\u65b9\u5f88\u6c34 (\u6bb5\u5b50)\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" style=\"text-decoration: underline;color: rgb(72, 179, 120);\" data-linktype=\"2\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"color: rgb(72, 179, 120);\"><strong>\u7a0b\u5e8f\u5458:\u6709\u54ea\u4e9b\u8bdd\u4e00\u542c\u5c31\u77e5\u9053\u5bf9\u65b9\u5f88\u6c34 (\u6bb5\u5b50)<\/strong><\/span><\/a><\/section>\n<\/li>\n<li style=\"outline: 0px;color: rgb(72, 179, 120);font-weight: bold;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzI1ODI1ODkzMA==&amp;mid=2247491907&amp;idx=1&amp;sn=6bacf8d8da914913ee618617a78882d4&amp;chksm=ea0843dedd7fcac8fbba0b1ab2e2451219f4b63a04517fbc3be4404db4a439f200ede4f0b9e4&amp;scene=21#wechat_redirect\" textvalue=\"IntelliJ IDEA\u5feb\u6377\u952e\u5927\u5168 + \u52a8\u56fe\u6f14\u793a\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" style=\"text-decoration: underline;color: rgb(72, 179, 120);\" data-linktype=\"2\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"color: rgb(72, 179, 120);\"><strong>IntelliJ IDEA\u5feb\u6377\u952e\u5927\u5168 + \u52a8\u56fe\u6f14\u793a<\/strong><\/span><\/a><\/section>\n<\/li>\n<li style=\"outline: 0px;color: rgb(72, 179, 120);font-weight: bold;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzI1ODI1ODkzMA==&amp;mid=2247491752&amp;idx=1&amp;sn=9327e11596088667bf0b655fa65658db&amp;chksm=ea084235dd7fcb23e936bd1ada5eaa2faf9f43b0e3124d3432cb9861b53d3811c23d1bcb6979&amp;scene=21#wechat_redirect\" textvalue=\"MySQL8.0\u7684INT\u7c7b\u578b\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" style=\"text-decoration: underline;color: rgb(72, 179, 120);\" data-linktype=\"2\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"color: rgb(72, 179, 120);\"><strong>MySQL8.0\u7684INT\u7c7b\u578b\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/strong><\/span><\/a><\/section>\n<\/li>\n<li style=\"outline: 0px;color: rgb(72, 179, 120);font-weight: bold;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzI1ODI1ODkzMA==&amp;mid=2247491713&amp;idx=1&amp;sn=1c1befcb5e514358d51531f736574b78&amp;chksm=ea08421cdd7fcb0a551dfb988c24a2ab1eb3dac7e8eb2de4a67cda3eab42986f98693fc9098c&amp;scene=21#wechat_redirect\" textvalue=\"\u4f60\u771f\u7684\u4f1a\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a\u5417\uff1f\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" style=\"text-decoration: underline;\" data-linktype=\"2\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"text-decoration: underline;color: rgb(72, 179, 120);\"><strong>\u4f60\u771f\u7684\u4f1a\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a\u5417\uff1f<\/strong><\/span><\/a><br  \/><\/section>\n<\/li>\n<\/ul>\n<\/section>\n<p style=\"outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);margin-bottom: 0px;\"><br style=\"outline: 0px;\"  \/><\/p>\n<section class=\"mp_profile_iframe_wrp\"><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-weui-theme=\"light\" data-id=\"MzI1ODI1ODkzMA==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/s9sLltmnMYnfaMs6fFE62T5QficQhZwUQ7rSCmgfFVxDyGrmoiaHMFYibBP7ZBichEgFZB218YRCWPhicfAUQqpGq6w\/0?wx_fmt=png\" data-nickname=\"java\u5c0f\u767d\u7ffb\u8eab\" data-alias=\"tuziblog\" data-signature=\"\u4e13\u6ce8\u4e8eJAVA\u77e5\u8bc6\u5206\u4eab\uff0c\u4e92\u8054\u7f51\u6280\u672f~\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><\/section>\n<section style=\"outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);margin-bottom: 0px;\"><img decoding=\"async\" class=\"rich_pages wxw-img __bg_gif lazyload\" data-galleryid=\"\" data-ratio=\"0.2777777777777778\"  data-type=\"gif\" data-w=\"1080\" style=\"outline: 0px;text-align: center;letter-spacing: 0.034em;width: 677px !important;visibility: visible !important;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010343638.gif\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img __bg_gif\" data-galleryid=\"\" data-ratio=\"0.2777777777777778\"  data-type=\"gif\" data-w=\"1080\" style=\"outline: 0px;text-align: center;letter-spacing: 0.034em;width: 677px !important;visibility: visible !important;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010343638.gif\"  \/><\/noscript><\/section>\n<p style=\"margin-bottom: 0px;\"><br  \/><\/p>\n<p><br  \/><\/p>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 java\u5c0f\u767d\u7ffb\u8eab              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1agelald \u6765\u6e90\uff1ajuejin.cn\/post\/7123091045071454238 \u8bf4\u5230 Controller\uff0c\u76f8\u4fe1\u5927 &#8230;<\/p>\n","protected":false},"author":2,"featured_media":531,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[2,6,7,8],"tags":[],"class_list":["post-535","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-spring","category-spring-boot","category-spring-cloud"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010339609.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010340453.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010341821.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010341821.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010343638.gif","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528010343638.gif","id":"image5"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Java","post_date":"2023-05-27","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":767,"next_post_id":715,"next_post_title":"Spring @DependsOn\u6ce8\u89e3\u89e3\u6790","previous_post_id":688,"previous_post_title":"JAVA \u7ebf\u4e0a\u6545\u969c\u6392\u67e5\u5b8c\u6574\u5957\u8def\uff0c\u4ece CPU\u3001\u78c1\u76d8\u3001\u5185\u5b58\u3001\u7f51\u7edc\u3001GC \u4e00\u6761\u9f99\uff01","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/535","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/535\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/531"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}