{"id":438323,"date":"2021-04-13T16:40:04","date_gmt":"2021-04-13T08:40:04","guid":{"rendered":"http:\/\/4563.org\/?p=438323"},"modified":"2021-04-13T16:40:04","modified_gmt":"2021-04-13T08:40:04","slug":"java-%e6%b3%9b%e5%9e%8b-%e6%8e%a5%e5%8f%a3%e8%bf%94%e5%9b%9e%e7%b1%bb-%e5%a6%82%e4%bd%95%e9%9d%a2%e5%af%b9-%e7%a9%ba%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=438323","title":{"rendered":"Java \u6cdb\u578b \u63a5\u53e3\u8fd4\u56de\u7c7b \u5982\u4f55\u9762\u5bf9 \u7a7a\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Java \u6cdb\u578b \u63a5\u53e3\u8fd4\u56de\u7c7b \u5982\u4f55\u9762\u5bf9 \u7a7a\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h1>Java \u63a5\u53e3\u8fd4\u56de\u7c7b \u4e2d \u6cdb\u578b\u5982\u4f55\u9762\u5bf9 \u8fd4\u56de\u503c\u672c\u5e94\u4e3a<code>null<\/code>\u7684\u60c5\u51b5\uff1f?<\/h1>\n<p> <\/p>\n<p>\u5728\u8bbe\u8ba1 web \u5e94\u7528\u4e2d\u7684\u8fd4\u56de\u57fa\u7840\u7c7b\u65f6\uff0c\u6211\u4f1a\u8fd9\u6837\u5199<\/p>\n<pre><code>public class BaseResponse&lt;T&gt; implements Serializable {    private static final long serialVersionUID = 1L;      private int code;     private String message;     private T data;      \/\/... \u7701\u7565\u6784\u9020\u65b9\u6cd5\u7b49      public static BaseResponse success() {         return new BaseResponse();     }      public static BaseResponse success(String message) {         return new BaseResponse(RespCodeEnum.SUCCESS, message);     }          \/\/... \u7701\u7565\u5931\u8d25\u7b49 }  <\/code><\/pre>\n<p>\u5f53\u5728 controller \u4e2d \u4f7f\u7528\u8fd9\u4e9b\u57fa\u7840\u8fd4\u56de\u7c7b\u8fdb\u884c\u6570\u636e\u5305\u88c5\u65f6\uff0c\u901a\u8fc7\u6cdb\u578b\u8fdb\u884c\u8fd4\u56de\u5185\u5bb9\u7684\u6307\u5b9a<\/p>\n<p>\u4f46 \u4f8b\u5982\u4e00\u4e9b\u6dfb\u52a0\u64cd\u4f5c\u65f6\uff0c\u5c06\u4e0d\u4f1a\u6709\u5177\u4f53\u7684\u8fd4\u56de\u503c\uff0c\u53ea\u4f1a\u8fd4\u56de code \u6765\u5224\u65ad\u662f\u5426\u64cd\u4f5c\u6210\u529f<\/p>\n<pre><code>@PostMapping(\"\/something\") public BaseResponse postSomething(@Valid @RequestBody Something request) {      \/\/\u6dfb\u52a0\u64cd\u4f5c      \/\/\u6839\u636e\u6dfb\u52a0\u64cd\u4f5c\u5224\u65ad\u8fd4\u56de\u5185\u5bb9     \/\/ if success     return new BaseResponse.success();      \/\/ if failed ... }   <\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6211\u6ca1\u6709\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b\uff0c\u56e0\u4e3a\u6709\u4e9b\u6dfb\u52a0\u64cd\u4f5c\u65f6\uff0c\u6ca1\u6709\u5177\u4f53\u7684\u8fd4\u56de\u503c\u5185\u5bb9\uff0c\u6211\u672c\u6765\u60f3\u5199\u6210 <code>public BaseResponse&lt;Void&gt; postSomething<\/code>\uff0c\u4f46\u5728<code>return<\/code>\u65f6\uff0c\u5374\u4e0d\u77e5\u9053\u8be5\u5982\u4f55\u5199\u3002<\/p>\n<p>\u60f3\u8bf7\u95ee\u4e00\u4e0b\uff0c\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b \u7406\u8bba\u4e0a\u5e94\u8be5\u662f\u90fd\u8fdb\u884c\u7684\uff08\u5982\u679c\u8bf4\u9519\uff0c\u8bf7\u4e0d\u8981\u6253\u6211\uff0c\u4e2a\u4eba\u60f3\u6cd5 \/(\u3112o\u3112)\/~~\uff09\uff0c<\/p>\n<p>\u4f46\u5728\u8fd9\u91cc\u5982\u4f55\u8fdb\u884c\u6b63\u786e\u7684\u6cdb\u578b\u7c7b\u578b\u6307\u5b9a\u5462\uff08\u6216\u8005\u8bf4\u9700\u8981\u6307\u5b9a\u6cdb\u578b\u4e48\uff09\uff1f<\/p>\n<p>\uff08\u592a\u591a\u77e5\u8bc6\u4e0d\u61c2\uff0c\u5929\u5929\u6765\u95ee v \u53cb\uff0c\u5b66\u5230\u4e86\u5f88\u591a\uff0c\u611f\u8c22\u611f\u8c22<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>28<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5749860\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yuanmomo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u8bb0\u9519\u7684\u8bdd\uff0c\u6211\u5e94\u8be5\u7528\u7684\u662f\u95ee\u53f7                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749861\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xarthur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u8981\u7528 null \u4e0d\u5c31\u884c\u4e86\u2026\u2026<br \/>\u7528 Optional \u3002<br \/>\u6211\u4ee5\u4e3a null-safety \u5df2\u7ecf\u662f\u4e2a\u5e38\u8bc6\u4e86\uff08                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749862\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xarthur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53e6\u5916\u5b8c\u5168\u6ca1\u770b\u61c2\u4f60\u7684\u4f8b\u5b50\uff08                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749863\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xarthur \u53ef\u80fd\u6211\u8868\u8fbe\u7684\u4e0d\u592a\u597d hhhh\uff0c\u5c31\u662f BaseResponse \u57fa\u7840\u8fd4\u56de\u7c7b\u4e2d\u7684 data \u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\u662f\u6ca1\u6709\u503c\u7684\uff0c\u53ea\u6709 code \u548c message \u6709\u503c\uff0c\u5728\u786e\u5b9a data \u662f\u6ca1\u6709\u503c\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u8fd8\u60f3\u8981\u5728\u5199 controller \u65b9\u6cd5\u7684\u65f6\u5019\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b\uff0c\u8be5\u600e\u4e48\u6307\u5b9a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749864\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhazi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Void                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749865\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lwq84510 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u662f\u7b54\u6848                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749866\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aguesuka <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u8981\u4f7f\u7528\u95ee\u53f7\u4f5c\u4e3a\u6cdb\u578b<\/p>\n<p>@PostMapping(&#8220;\/something&#8221;)<br \/>public BaseResponse&lt;Void&gt; \/*\u6539\u4e86\u8fd9\u91cc*\/postSomething(@Valid @RequestBody Something request) {<\/p>\n<p> \/\/\u6dfb\u52a0\u64cd\u4f5c<\/p>\n<p> \/\/\u6839\u636e\u6dfb\u52a0\u64cd\u4f5c\u5224\u65ad\u8fd4\u56de\u5185\u5bb9<br \/> \/\/ if success<br \/> return new BaseResponse.&lt;Void&gt;\/*\u4f1a\u6709\u7070\u8272\u8b66\u544a\uff0c\u5373\u53ef\u5c06\u5176\u7701\u7565*\/success();<\/p>\n<p> \/\/ if failed &#8230;<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749867\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wolfie <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u9762\u8bf4\u4e86 \u95ee\u53f7\uff0c\u6216\u8005\u4e0d\u7406\u4f1a\u7f16\u8bd1\u5668\u63d0\u9192 \u4e0d\u52a0\u6cdb\u578b\u4e5f\u6ca1\u95ee\u9898\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749868\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : passerbytiny <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u9700\u8981\u6784\u9020\u7684\u662f\uff1aBaseResponse&lt;Object&gt;\uff0c\u5728\u54ea\u3002\u4efb\u4f55\u7c7b\u578b\u53ef\u4ee5\u627f\u8f7d null\uff0c\u5728\u4f60\u53ea\u9700\u8981\u5b83\u662f null \u800c\u4e0d\u5173\u5fc3\u5177\u4f53\u7c7b\u578b\u7684\u65f6\u5019\uff0c\u6700\u9ad8\u57fa\u7c7b Object \u662f\u4e00\u4e2a\u52c9\u5f3a\u7684\u9009\u62e9\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749869\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : passerbytiny <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4f60\u8fd9\u91cc\u7684\u6cdb\u578b\uff0c\u5e76\u4e0d\u662f\u7ed9\u7c7b\u4f3c Swagger \u8fd9\u6837\u7684\u81ea\u52a8\u751f\u6210 API \u6587\u6863\u7684\u5de5\u5177\u7528\u7684\uff0c\u90a3\u4e48\u5b83\u662f\u753b\u86c7\u6dfb\u8db3\u7684\u4e1c\u897f\uff0c\u56e0\u4e3a Cortroller \u65b9\u6cd5\u662f\u975e\u6846\u67b6\u4ee3\u7801\u4e2d\u7684\u6700\u5916\u5c42\u2014\u2014\u9664\u4e86\u6846\u67b6\u4e0d\u4f1a\u6709\u4eba\u4ece\u5b83\u90a3\u91cc\u83b7\u53d6\u8fd4\u56de\u503c\u3002<\/p>\n<p>\u8fd9\u91cc\u53bb\u6389\u6cdb\u578b\uff0c\u76f4\u63a5\u5c06 data \u5b9a\u4e49\u6210 Object \u7c7b\u578b\uff0c\u4f1a\u66f4\u597d\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749870\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : AoEiuV020 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e00\u822c\u7528 String\uff0c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749871\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             public class BaseResponse implements Serializable {<br \/> private static final long serialVersionUID = 1L;<\/p>\n<p> private int code;<br \/> private String message;<br \/> private Object data;<\/p>\n<p> \/\/&#8230; \u7701\u7565\u6784\u9020\u65b9\u6cd5\u7b49<\/p>\n<p> public static BaseResponse success() {<br \/> return new BaseResponse();<br \/> }<br \/> public static BaseResponse success(String message) {<br \/> return new BaseResponse(RespCodeEnum.SUCCESS, message);<br \/> }<\/p>\n<p> \/\/&#8230; \u7701\u7565\u5931\u8d25\u7b49<br \/>}<\/p>\n<p>\u4e0d\u7528\u6cdb\u578b\uff0c\u7528 Object \u3002\u56e0\u4e3a\u4f60\u4e0d\u7528\u77e5\u9053\u7c7b\u578b\u4e5f\u80fd\u5e8f\u5217\u5316\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749872\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f53\u7136\uff0c\u4f60\u8981\u7528 swgger \u8fd9\u4e9b\u81ea\u52a8\u5316\u6587\u6863\u7684\u8bdd\uff0c\u8fd4\u56de\u7684\u65f6\u5019\u7a7a\u4e5f\u4e0d\u5f71\u54cd\u554a\u3002\u4e3a\u5565\u8981 new BaseResponse \uff1f return this \u5c31\u884c\u4e86\u5440\u3002<\/p>\n<p> public BaseResponse success() {<br \/> setCode(200);<br \/> setMessage(&#8220;\u8bf7\u6c42\u6210\u529f&#8221;);<\/p>\n<p> return this;<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749873\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Oktfolio <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             BaseResponse&lt;?&gt;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749874\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : beichenhpy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u662f\u8bf4\u4f60\u7684 data \u662f T \u7c7b\u578b\u7684\uff1f\u6211\u4eec\u4e00\u822c\u7528&lt;?&gt;\u4ee3\u66ff                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749875\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : EscYezi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/gist.github.com\/yeziyezi\/9f42b951fed3a547409ed1552381c1d4 <button onclick=\"lazyGist(this)\">\u00a0\u663e\u793a Gist \u4ee3\u7801\u00a0<\/button> <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749876\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @passerbytiny \u4f46\u5982\u679c\u662f Object \u7684\u8bdd\uff0c\u6211\u5c31\u4e0d\u80fd\u5728\u7f16\u8bd1\u548c\u8fd0\u884c\u524d\u5c31\u77e5\u9053\u8fd4\u56de\u503c\u662f\u5426\u662f\u6211\u671f\u671b\u7684\u5185\u5bb9\u4e86\u554a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749877\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : arthas2234 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u90fd\u662f\u5728 controller \u76f4\u63a5\u8fd4\u56de\u5bf9\u8c61\uff0c\u6ca1\u6709\u8fd4\u56de\u503c\u5c31\u662f void<br \/>\u7136\u540e\u5b9e\u73b0 ResponseBodyAdvice \u62e6\u622a controller \u65b9\u6cd5\u9ed8\u8ba4\u8fd4\u56de\u53c2\u6570\uff0c\u7edf\u4e00\u5904\u7406\u8fd4\u56de\u503c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749878\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @arthas2234 \u62d3\u5c55\u4e86\u65b0\u601d\u8def                                                             <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749879\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : young1lin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e0d\u5efa\u8bae\u4f60\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u8fd4\u56de\u7ed3\u679c\uff0c\u4f7f\u7528 ResponseEntity&lt;?&gt; \u5c31\u884c\u4e86\uff0c\u771f\u7684\uff0c\u8fd9\u4e2a\u5f88\u91cd\u8981\u3002\u4f60\u5fc5\u987b\u4e86\u89e3\u5404\u4e2a\u72b6\u6001\u7801\u5927\u6982\u662f\u4ec0\u4e48\u610f\u601d\uff0c\u4e0d\u8981\u518d\u4e8c\u6b21\u5305\u88c5 HTTP \u72b6\u6001\u4e86\uff0c\u90a3\u4e2a\u4e0d\u592a\u597d\uff0c\u5bf9\u524d\u7aef\u548c\u5bf9\u63a5\u7684\u4eba\uff0c\u90fd\u662f\u6298\u78e8\uff0c\u8fd8\u8981\u518d\u89e3\u6790\u4e00\u904d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749880\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chanchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf4?\u7684\u6211\u5410\u4e86,\u589e\u52a0\u4ee3\u7801\u9605\u8bfb\u6210\u672c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749881\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Valid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u8fd9\u4e2a\u540d\u5b57\u6bcf\u6b21\u90fd\u4f1a\u88ab\u8feb\u5b66\u4e60 java                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749882\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : beichenhpy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd4\u56de\u503c\u7c7b\u4e2d\u6539\u6210\u8fd9\u6837\u5427<br \/> public static &lt;T&gt; Result&lt;T&gt; success(){<br \/> return new Result&lt;&gt;(HttpStatus.Ok);<br \/> }<br \/>\u8fd9\u6837\u4f60\u5199\u4ec0\u4e48\u6cdb\u578b\u90fd\u65e0\u6240\u8c13\u7684\u3002\u3002\u4f60\u7684 T \u5bf9\u5e94\u7684\u90fd\u662f null \u4e86<br \/>\u4f7f\u7528\u5c31\u76f4\u63a5 <br \/> public Result&lt;Void&gt; test(){<br \/> return Result.success();<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749883\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @young1lin \u6211\u4e5f\u8fd9\u4e48\u89c9\u5f97\uff01 \u4f46\u662f\u770b\u5230\u516c\u53f8\u662f\u8fd9\u4e48\u505a\u7684&#8230;\u6240\u4ee5\u5c31\u6539\u53d8\u4e86\u6211\u7684\u601d\u8def                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749884\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Valid \u54c8\u54c8\u54c8\u54c8\u54c8\u54c8 \u75af\u72c2\u88ab at \u4e48                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749885\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : young1lin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @RiceMarch \u4f60\u53ef\u4ee5\u8bb0\u4e0b\u6765\uff0c\u5199\u51fa\u5bf9\u5e94\u7684 Demo \u8ba9\u5927\u5bb6\u770b\uff0c\u5e76\u8bb0\u5f55\u6709\u4ec0\u4e48\u597d\u5904\u4e4b\u7c7b\u7684\u3002\u7136\u540e\u4e0b\u6b21\u5f00\u4f1a\u6216\u8005\u9002\u5f53\u7684\u65f6\u5019\u63d0\u51fa\u6765\uff0c\u6539\u6389\u8fd9\u4e2a\u3002\u4e8c\u6b21\u5305\u88c5 HTTP \u5df2\u7ecf\u5b58\u5728\u7684\u4e1c\u897f\uff0c\u4e0d\u592a\u597d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749886\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RiceMarch <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @young1lin \u8fd9\u4e2a\u592a\u96be\u4e86 \u516c\u53f8\u81ea\u5df1\u5df2\u7ecf\u5c01\u88c5\u4e86\u4e00\u5957\u5f88\u5168\u7684\u4e1c\u897f\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5749887\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liian2019 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Object                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Java \u6cdb\u578b \u63a5\u53e3\u8fd4\u56de\u7c7b \u5982\u4f55\u9762&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/438323"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=438323"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/438323\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=438323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=438323"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=438323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}