{"id":1130,"date":"2014-12-27T21:25:50","date_gmt":"2014-12-27T13:25:50","guid":{"rendered":"http:\/\/coderbee.net\/?p=1130"},"modified":"2014-12-27T21:26:17","modified_gmt":"2014-12-27T13:26:17","slug":"%e6%95%b0%e6%8d%ae%e4%b8%8d%e5%8f%af%e5%8f%98-%e4%b8%8e-%e6%96%b9%e6%b3%95%e5%89%af%e4%bd%9c%e7%94%a8","status":"publish","type":"post","link":"https:\/\/coderbee.net\/index.php\/notes\/20141227\/1130","title":{"rendered":"\u6570\u636e\u4e0d\u53ef\u53d8 \u4e0e \u65b9\u6cd5\u526f\u4f5c\u7528"},"content":{"rendered":"<h3>\u4e00\u3001\u95ee\u9898<\/h3>\n<p>\u4e4b\u524d\u7684\u6587\u7ae0\u63d0\u5230\u516c\u53f8\u8981\u6c42\u9879\u76ee\u7ec4\u505a\u6240\u8c13\u7684\u7f51\u7edc\u6807\u51c6\u5316\uff0c\u5728 Spring MVC \u7684 Controller \u5c42\u4e0e Service \u5c42\u4e4b\u95f4\u62c6\u5206\u6210\u4e24\u4e2a\u9879\u76ee\u6765\u90e8\u7f72\uff0c\u4e2d\u95f4\u901a\u8fc7 Hessian \u8fdc\u7a0b\u8c03\u7528\u6765\u901a\u4fe1\u3002<\/p>\n<p>\u8fd9\u6837\u53ef\u5c31\u6709\u5927\u95ee\u9898\u4e86\uff1a<\/p>\n<blockquote>\n<p>Controller \u8c03\u7528 Service \u7684\u65b9\u6cd5\u65f6\uff0c\u4f20\u9012\u4e00\u4e2a POJO \u4f5c\u4e3a\u53c2\u6570\uff0cService \u91cc\u4fee\u6539\u4e86\u8fd9\u4e2a\u53c2\u6570\u7684\u67d0\u4e2a\u5c5e\u6027\uff0c\u6700\u7ec8\u8fd4\u8fd8 Controller\uff0cController \u518d\u6839\u636e\u8fd9\u4e2a\u88ab\u4fee\u6539\u7684\u5c5e\u6027\u7ee7\u7eed\u5904\u7406\uff1b<\/p>\n<p>Service \u8c03\u7528\u7684\u6df1\u5c42\u65b9\u6cd5\u901a\u8fc7 Spring MVC \u901a\u8fc7\u7684 <code>org.springframework.web.context.request.RequestContextHolder<\/code> \u83b7\u53d6\u4e86 <code>HttpSession<\/code> \u5bf9\u8c61\uff0c\u7136\u540e\u8bbe\u7f6e\u4e86\u4e00\u4e9b\u72b6\u6001\u503c\u3002<\/p>\n<\/blockquote>\n<p>\u5728\u540c\u4e00 JVM \u91cc\u9762\uff0c\u4e0a\u9762\u7684\u90fd\u6ca1\u6709\u95ee\u9898\uff1b\u4f46\u6309\u6807\u51c6\u5316\u7684\u8981\u6c42\uff0c\u90e8\u7f72\u5728\u4e24\u4e2a JVM \u4e0a\u65f6\uff0cService \u5c42\u5bf9 Controller \u5c42\u4f20\u5165\u7684 POJO \u6240\u505a\u7684\u4fee\u6539\u5728 Controller \u5c42\u5c31\u4e0d\u53ef\u89c1\u4e86\u3002<\/p>\n<p>\u8fd9\u4e9b\u95ee\u9898\u662f\u5b9e\u73b0\u8fd9\u4e2a\u6807\u51c6\u5316\u7684\u6700\u5927\u56f0\u96be\uff0c\u51e0\u4e4e\u6240\u6709\u4ee3\u7801\u90fd\u8981\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0a\u9762\u7684\u60c5\u51b5\u3002<\/p>\n<h3>\u4e8c\u3001\u5982\u679c\u4e0a\u5929\u518d\u7ed9\u4e00\u6b21\u673a\u4f1a\u3002\u3002\u3002<\/h3>\n<p>\u4e0a\u9762\u7684\u95ee\u9898\u53ef\u4ee5\u8bf4\u662f\u201c\u53c2\u6570\u7684\u53ef\u53d8\u6027\u201d\u548c\u201c\u65b9\u6cd5\u526f\u4f5c\u7528\u201d\u5bfc\u81f4\u7684\uff0c\u201c\u53c2\u6570\u201d \u662f\u4e2a\u7279\u6b8a\u7684\u4e1c\u897f\uff0c\u5b83\u7a7f\u8fc7\u4e24\u4e2a\u65b9\u6cd5\u4e4b\u95f4\u8c03\u7528\u65f6\u5f62\u6210\u7684\u8fb9\u754c\u3002\u5982\u679c\u201c\u53c2\u6570\u201d\u7684\u5c5e\u6027\u5728\u88ab\u8c03\u7528\u7684\u65b9\u6cd5\u91cc\u88ab\u4fee\u6539\u4e86\uff0c\u53ef\u4ee5\u8bf4\u8fd9\u4e2a\u65b9\u6cd5\u662f\u6709\u526f\u4f5c\u7528\u7684\u3002<\/p>\n<p>\u5982\u679c\u4e0a\u5929\u518d\u7ed9\u4e00\u6b21\u673a\u4f1a\uff1a\u628a\u6240\u6709\u65b9\u6cd5\u90fd\u5b9e\u73b0\u4e3a\u65e0\u526f\u4f5c\u7528\uff0c\u53c2\u6570\u5c01\u88c5\u4e3a\u4e0d\u53ef\u53d8\u7684\u5bf9\u8c61\uff0c\u65b9\u6cd5\u7684\u6240\u6709\u6548\u679c\u90fd\u901a\u8fc7\u8fd4\u56de\u503c\u6765\u4f53\u73b0\u3002\u8fd9\u6837\u6bcf\u4e00\u4e2a\u65b9\u6cd5\u90fd\u53ef\u4ee5\u53d8\u6210\u4e00\u4e2a\u8fdc\u7a0b\u670d\u52a1\u3002<\/p>\n<p>\u4e4b\u524d\u5728\u5fae\u535a\u4e0a\u770b\u5230\u4e00\u4e2a\u8bf4\u4ed6\u7684\u67b6\u6784\u5ba3\u8a00\u662f\uff1aPassing Message Everywhere\u3002\u6709\u70b9\u611f\u89e6\u3002<\/p>\n<hr\/>\n<p>\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u5fae\u4fe1\u516c\u4f17\u53f7: <strong>coderbee\u7b14\u8bb0<\/strong>\uff0c\u53ef\u4ee5\u66f4\u53ca\u65f6\u56de\u590d\u4f60\u7684\u8ba8\u8bba\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"258\" height=\"258\" src=\"https:\/\/coderbee.net\/wp-content\/uploads\/2019\/01\/coderbee-note.jpg\" class=\"alignnone size-full wp-image-1707\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u95ee\u9898 \u4e4b\u524d\u7684\u6587\u7ae0\u63d0\u5230\u516c\u53f8\u8981\u6c42\u9879\u76ee\u7ec4\u505a\u6240\u8c13\u7684\u7f51\u7edc\u6807\u51c6\u5316\uff0c\u5728 Spring MV &hellip; <a href=\"https:\/\/coderbee.net\/index.php\/notes\/20141227\/1130\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[209],"_links":{"self":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1130"}],"collection":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/comments?post=1130"}],"version-history":[{"count":2,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1130\/revisions"}],"predecessor-version":[{"id":1132,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/1130\/revisions\/1132"}],"wp:attachment":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/media?parent=1130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/categories?post=1130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/tags?post=1130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}