{"id":7096,"date":"2024-04-15T15:01:01","date_gmt":"2024-04-15T07:01:01","guid":{"rendered":""},"modified":"2024-04-15T15:01:01","modified_gmt":"2024-04-15T07:01:01","slug":"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7096.html","title":{"rendered":"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3"},"content":{"rendered":"

\u76ee\u5f55<\/strong><\/p>\n

\n

1.springMVC\u6d41\u7a0b<\/p>\n

2.spring\u6846\u67b6<\/p>\n

2.1\u4ec0\u4e48\u662fspring\u6846\u67b6<\/p>\n

2.2 spring\u4f18\u7f3a\u70b9<\/p>\n

2.3\u4e3a\u4ec0\u4e48\u4f7f\u7528spring\uff1f<\/p>\n

2.4\u5982\u4f55\u4f7f\u7528spring\uff1f<\/p>\n


\n

1.springMVC\u6d41\u7a0b<\/h2>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

\n

\u7b2c\u4e00\u6b65\uff1a\u7528\u6237\u53d1\u9001\u8bf7\u6c42\u5230\u524d\u7aef\u63a7\u5236\u5668\uff08DispatcherServlet\uff09\u3002<\/p>\n

\u7b2c\u4e8c\u6b65\uff1a\u524d\u7aef\u63a7\u5236\u5668\u8bf7\u6c42 HandlerMapping \u67e5\u627e Handler\uff0c\u53ef\u4ee5\u6839\u636e xml \u914d\u7f6e\u3001\u6ce8\u89e3\u8fdb\u884c\u67e5\u627e\u3002<\/p>\n

\u7b2c\u4e09\u6b65\uff1a \u5904\u7406\u5668\u6620\u5c04\u5668 HandlerMapping \u5411\u524d\u7aef\u63a7\u5236\u5668\u8fd4\u56de Handler<\/p>\n

\u7b2c\u56db\u6b65\uff1a\u524d\u7aef\u63a7\u5236\u5668\u8c03\u7528\u5904\u7406\u5668\u9002\u914d\u5668\u53bb\u6267\u884c Handler<\/p>\n

\u7b2c\u4e94\u6b65\uff1a\u5904\u7406\u5668\u9002\u914d\u5668\u6267\u884c Handler<\/p>\n

\u7b2c\u516d\u6b65\uff1aHandler \u6267\u884c\u5b8c\u6210\u540e\u7ed9\u9002\u914d\u5668\u8fd4\u56de ModelAndView<\/p>\n

\u7b2c\u4e03\u6b65\uff1a\u5904\u7406\u5668\u9002\u914d\u5668\u5411\u524d\u7aef\u63a7\u5236\u5668\u8fd4\u56de ModelAndView<\/p>\n

              ModelAndView \u662fSpringMVC \u6846\u67b6\u7684\u4e00\u4e2a\u5e95\u5c42\u5bf9\u8c61\uff0c\u5305\u62ec Model \u548c View<\/p>\n

\u7b2c\u516b\u6b65\uff1a\u524d\u7aef\u63a7\u5236\u5668\u8bf7\u6c42\u8bd5\u56fe\u89e3\u6790\u5668\u53bb\u8fdb\u884c\u89c6\u56fe\u89e3\u6790<\/p>\n

\u6839\u636e\u903b\u8f91\u89c6\u56fe\u540d\u6765\u89e3\u6790\u771f\u6b63\u7684\u89c6\u56fe\u3002<\/p>\n

\u7b2c\u4e5d\u6b65\uff1a\u8bd5\u56fe\u89e3\u6790\u5668\u5411\u524d\u7aef\u63a7\u5236\u5668\u8fd4\u56de view<\/p>\n

\u7b2c\u5341\u6b65\uff1a\u524d\u7aef\u63a7\u5236\u5668\u8fdb\u884c\u89c6\u56fe\u6e32\u67d3<\/p>\n

\u5c31\u662f\u5c06\u6a21\u578b\u6570\u636e\uff08\u5728 ModelAndView \u5bf9\u8c61\u4e2d\uff09\u586b\u5145\u5230 request \u57df<\/p>\n

\u7b2c\u5341\u4e00\u6b65\uff1a\u524d\u7aef\u63a7\u5236\u5668\u5411\u7528\u6237\u54cd\u5e94\u7ed3\u679c<\/p>\n

 <\/p>\n<\/blockquote>\n

2.spring\u6846\u67b6<\/h2>\n

2.1\u4ec0\u4e48\u662fspring\u6846\u67b6<\/h4>\n
\n

Spring\u662f\u5206\u5c42\u7684 Java SE\/EE\u5e94\u7528 full-stack \u8f7b\u91cf\u7ea7\u5f00\u6e90\u6846\u67b6\uff0c\u4ee5 IoC\uff08Inverse Of Control\uff1a\u53cd\u8f6c\u63a7\u5236\uff09\u548c AOP\uff08Aspect Oriented Programming\uff1a\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff09\u4e3a\u5185\u6838\u3002<\/p>\n

\u63d0\u4f9b\u4e86\u5c55\u73b0\u5c42 SpringMVC \u548c\u6301\u4e45\u5c42 Spring JDBCTemplate \u4ee5\u53ca\u4e1a\u52a1\u5c42\u4e8b\u52a1\u7ba1\u7406\u7b49\u4f17\u591a\u7684\u4f01\u4e1a\u7ea7\u5e94\u7528\u6280\u672f\uff0c\u8fd8\u80fd\u6574\u5408\u5f00\u6e90\u4e16\u754c\u4f17\u591a\u8457\u540d\u7684\u7b2c\u4e09\u65b9\u6846\u67b6\u548c\u7c7b\u5e93\uff0c\u9010\u6e10\u6210\u4e3a\u4f7f\u7528\u6700\u591a\u7684Java EE \u4f01\u4e1a\u5e94\u7528\u5f00\u6e90\u6846\u67b6\u3002<\/p>\n<\/blockquote>\n

2.2 spring\u4f18\u7f3a\u70b9<\/h4>\n
\n

1\uff09\u65b9\u4fbf\u89e3\u8026\uff0c\u7b80\u5316\u5f00\u53d1 \u901a\u8fc7 Spring \u63d0\u4f9b\u7684 IoC\u5bb9\u5668\uff0c\u53ef\u4ee5\u5c06\u5bf9\u8c61\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\u4ea4\u7531 Spring \u8fdb\u884c\u63a7\u5236\uff0c\u907f\u514d\u786c\u7f16\u7801\u6240\u9020\u6210\u7684\u8fc7\u5ea6\u8026\u5408\u3002 \u7528\u6237\u4e5f\u4e0d\u5fc5\u518d\u4e3a\u5355\u4f8b\u6a21\u5f0f\u7c7b\u3001\u5c5e\u6027\u6587\u4ef6\u89e3\u6790\u7b49\u8fd9\u4e9b\u5f88\u5e95\u5c42\u7684\u9700\u6c42\u7f16\u5199\u4ee3\u7801\uff0c\u53ef\u4ee5\u66f4\u4e13\u6ce8\u4e8e\u4e0a\u5c42\u7684\u5e94\u7528\u3002<\/p>\n

2\uff09AOP \u7f16\u7a0b\u7684\u652f\u6301 \u901a\u8fc7 Spring\u7684 AOP \u529f\u80fd\uff0c\u65b9\u4fbf\u8fdb\u884c\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff0c\u8bb8\u591a\u4e0d\u5bb9\u6613\u7528\u4f20\u7edf OOP \u5b9e\u73b0\u7684\u529f\u80fd\u53ef\u4ee5\u901a\u8fc7 AOP \u8f7b\u677e\u5b9e\u73b0\u3002<\/p>\n

3\uff09\u58f0\u660e\u5f0f\u4e8b\u52a1\u7684\u652f\u6301 \u53ef\u4ee5\u5c06\u6211\u4eec\u4ece\u5355\u8c03\u70e6\u95f7\u7684\u4e8b\u52a1\u7ba1\u7406\u4ee3\u7801\u4e2d\u89e3\u8131\u51fa\u6765\uff0c\u901a\u8fc7\u58f0\u660e\u5f0f\u65b9\u5f0f\u7075\u6d3b\u7684\u8fdb\u884c\u4e8b\u52a1\u7ba1\u7406\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u8d28\u91cf\u3002<\/p>\n

4\uff09\u65b9\u4fbf\u7a0b\u5e8f\u7684\u6d4b\u8bd5 \u53ef\u4ee5\u7528\u975e\u5bb9\u5668\u4f9d\u8d56\u7684\u7f16\u7a0b\u65b9\u5f0f\u8fdb\u884c\u51e0\u4e4e\u6240\u6709\u7684\u6d4b\u8bd5\u5de5\u4f5c\uff0c\u6d4b\u8bd5\u4e0d\u518d\u662f\u6602\u8d35\u7684\u64cd\u4f5c\uff0c\u800c\u662f\u968f\u624b\u53ef\u505a\u7684\u4e8b\u60c5\u3002<\/p>\n

5\uff09\u65b9\u4fbf\u96c6\u6210\u5404\u79cd\u4f18\u79c0\u6846\u67b6 Spring\u5bf9\u5404\u79cd\u4f18\u79c0\u6846\u67b6\uff08Struts\u3001Hibernate\u3001Hessian\u3001Quartz\u7b49\uff09\u7684\u652f\u6301\u3002<\/p>\n

6\uff09\u964d\u4f4e JavaEE API \u7684\u4f7f\u7528\u96be\u5ea6 Spring\u5bf9 JavaEE API\uff08\u5982 JDBC\u3001JavaMail\u3001\u8fdc\u7a0b\u8c03\u7528\u7b49\uff09\u8fdb\u884c\u4e86\u8584\u8584\u7684\u5c01\u88c5\u5c42\uff0c\u4f7f\u8fd9\u4e9b API \u7684\u4f7f\u7528\u96be\u5ea6\u5927\u4e3a\u964d\u4f4e\u3002<\/p>\n

7\uff09Java \u6e90\u7801\u662f\u7ecf\u5178\u5b66\u4e60\u8303\u4f8b Spring\u7684\u6e90\u4ee3\u7801\u8bbe\u8ba1\u7cbe\u5999\u3001\u7ed3\u6784\u6e05\u6670\u3001\u5320\u5fc3\u72ec\u7528\uff0c\u5904\u5904\u4f53\u73b0\u7740\u5927\u5e08\u5bf9Java \u8bbe\u8ba1\u6a21\u5f0f\u7075\u6d3b\u8fd0\u7528\u4ee5\u53ca\u5bf9 Java\u6280\u672f\u7684\u9ad8\u6df1 \u9020\u8be3\u3002\u5b83\u7684\u6e90\u4ee3\u7801\u65e0\u610f\u662f Java \u6280\u672f\u7684\u6700\u4f73\u5b9e\u8df5\u7684\u8303\u4f8b\u3002<\/p>\n

 <\/p>\n<\/blockquote>\n

2.3\u4e3a\u4ec0\u4e48\u4f7f\u7528spring\uff1f<\/h4>\n

\u76ee\u7684\uff1a\u964d\u4f4e\u8026\u5408\uff1a\u5bf9\u8c61\u4e0e\u5bf9\u8c61\u4e4b\u95f4\u7684\u8026\u5408\u3002<\/p>\n

2.4\u5982\u4f55\u4f7f\u7528spring\uff1f<\/h4>\n

1.\u9996\u5148\u521b\u5efa\u4e00\u4e2aspring\u5de5\u7a0b\u3002<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

 2.\u6dfb\u52a0spring\u7684\u4f9d\u8d56<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

 3.\u521b\u5efaspring.xml\u6587\u4ef6<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

4.\u521b\u5efa\u5b9e\u4f53\u7c7bStudent\u5e76\u6dfb\u52a0\u4e24\u4e2a\u65b9\u6cd5<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

5.\u914d\u7f6espring\u3002xml\u7684\u914d\u7f6e\u6587\u4ef6 \u3002\u89e3\u91ca\u4e00\u4e0b\uff1a\u8fd9\u4e00\u6b21\u64cd\u4f5c\u65f6\u4e3a\u4e86\u8ba9spring\u6211\u4eec\u8981\u5728\u54ea\u4e2a\u7c7b\u521b\u5efa\u5bf9\u8c61<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3 6.\u6dfb\u52a0\u6d4b\u8bd5\u7c7b\uff0c\u8fdb\u884c\u6d4b\u8bd5<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

 \u6d4b\u8bd5\u7ed3\u679c\uff1a<\/p>\n

\"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3<\/p>\n

 \u53ef\u89c1\u8fd9\u91cc\u7684\u5bf9\u8c61\u5e76\u4e0d\u662f\u6211\u4eec\u81ea\u5df1new\u7684 \u662f\u6709spring\u7ed9\u6211\u4eec\u521b\u5efa\u51fa\u6765\u7684<\/p>\n<\/p>\n

    \n
  • \n

    \u63a7\u5236 : \u8c01\u6765\u63a7\u5236\u5bf9\u8c61\u7684\u521b\u5efa , \u4f20\u7edf\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u8c61\u662f\u7531\u7a0b\u5e8f\u672c\u8eab\u63a7\u5236\u521b\u5efa\u7684 , \u4f7f\u7528Spring\u540e , \u5bf9\u8c61\u662f\u7531Spring\u6765\u521b\u5efa\u7684<\/strong><\/p>\n<\/li>\n

  • \n

    \u53cd\u8f6c : \u7a0b\u5e8f\u672c\u8eab\u4e0d\u521b\u5efa\u5bf9\u8c61 , \u800c\u53d8\u6210\u88ab\u52a8\u7684\u63a5\u6536\u5bf9\u8c61<\/strong><\/p>\n<\/li>\n<\/ul>\n

     <\/p>\n

     <\/p>\n","protected":false},"excerpt":{"rendered":"spring\u6846\u67b6---\u7b80\u5355\u4e86\u89e3\u76ee\u5f551.springMVC\u6d41\u7a0b2.spring\u6846\u67b62.1\u4ec0\u4e48\u662fspring\u6846\u67b62.2spring\u4f18\u7f3a\u70b92.3\u4e3a\u4ec0\u4e48\u4f7f\u7528spring\uff1f2.4\u5982\u4f55\u4f7f...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7096"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7096"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7096\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}