{"id":2659,"date":"2018-04-14T16:27:04","date_gmt":"2018-04-14T08:27:04","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2659"},"modified":"2018-04-14T16:27:04","modified_gmt":"2018-04-14T08:27:04","slug":"%e4%bd%bf%e7%94%a8-maven-%e5%88%9b%e5%bb%ba-springboot-%e9%a1%b9%e7%9b%ae-2","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2659","title":{"rendered":"\u4f7f\u7528 Maven \u521b\u5efa SpringBoot \u9879\u76ee"},"content":{"rendered":"<p>\n\t\u4e0a\u4e00\u7bc7\u7684\u6587\u7ae0\u6709\u7f51\u53cb\u7ed9\u6211\u79c1\u4fe1\u8bf4\u6709\u4e9b\u7b80\u5355\u4e86\uff0c\u8ba9\u6211\u518d\u6765\u4e00\u4e2a <a href=\"https:\/\/www.xttblog.com\/?tag=springboot\" name=\"springboot\" target=\"_blank\" title=\"springboot\">SpringBoot<\/a> \u5165\u95e8\u7bc7\uff0c\u4e8e\u662f\u4fbf\u4e86\u6709\u8fd9\u7bc7\u6587\u7ae0\u3002\n<\/p>\n<p>\n\t\u5176\u5b9e <a href=\"https:\/\/www.xttblog.com\/?tag=springboot\" name=\"springboot\" target=\"_blank\" title=\"springboot\">SpringBoot<\/a> \u6ca1\u6709\u5927\u5bb6\u60f3\u8c61\u4e2d\u7684\u96be\uff0c\u53ef\u4ee5\u770b\u505a\u4ed6\u662f <a href=\"https:\/\/www.xttblog.com\/?tag=SpringMVC\" name=\"SpringMVC\" target=\"_blank\" title=\"SpringMVC\">SpringMVC<\/a> \u7684\u4e00\u4e2a\u5347\u7ea7\u7248\u3002\n<\/p>\n<p>\n\tSpringBoot \u63d0\u5021\u4e60\u60ef\u4f18\u4e8e\u914d\u7f6e\uff0c\u4e5f\u5e76\u4e0d\u662f\u8bf4\u4e0d\u9700\u8981\u914d\u7f6e\u3002<a href=\"https:\/\/www.xttblog.com\/?tag=springboot\" name=\"springboot\" target=\"_blank\" title=\"springboot\">SpringBoot<\/a> \u548c <a href=\"https:\/\/www.xttblog.com\/?tag=SpringMVC\" name=\"SpringMVC\" target=\"_blank\" title=\"SpringMVC\">SpringMVC<\/a> \u6700\u5927\u7684\u533a\u522b\u5728\u4e8e\uff0c\u4e00\u4e2a\u662f\u4ee5 jar \u7684\u5f62\u5f0f\u53d1\u5e03\uff0c\u4e00\u4e2a\u662f\u4ee5 war \u7684\u5f62\u5f0f\u53d1\u5e03\u3002\n<\/p>\n<p>\n\t\u53e6\u5916 SpringBoot \u662f\u5185\u5d4c <a href=\"https:\/\/baike.baidu.com\/item\/tomcat\" name=\"tomcat\" target=\"_blank\" title=\"tomcat\">tomcat<\/a> \u6216 <a href=\"https:\/\/baike.baidu.com\/item\/jetty\" name=\"jetty\" target=\"_blank\" title=\"jetty\">jetty<\/a> \u7684\u5f62\u5f0f\uff0c\u800c <a href=\"https:\/\/www.xttblog.com\/?tag=SpringMVC\" name=\"SpringMVC\" target=\"_blank\" title=\"SpringMVC\">SpringMVC<\/a> \u5219\u662f\u9700\u8981\u653e\u5230 Tomcat \u6216 JBoss \u7b49\u5bb9\u5668\u4e2d\u8fdb\u884c\u53d1\u5e03\u3002\n<\/p>\n<p>\n\t\u597d\u4e86\u5e9f\u8bdd\u4e0d\u591a\u5c11\u4e86\uff0c\u4e0b\u9762\u6211\u4eec\u5f00\u59cb SpringBoot \u7684\u5165\u95e8\u5b9e\u6218\u5427\uff01\n<\/p>\n<p>\n\t\u7b2c\u4e00\u6b65\uff0c\u8bbf\u95ee <a href=\"http:\/\/start.spring.io\/\" name=\"SpringBoot\" target=\"_blank\" title=\"SpringBoot\">http:\/\/start.spring.io\/<\/a>\u3002\n<\/p>\n<p>\n\t\u7b2c\u4e8c\u6b65\uff0c\u9009\u62e9\u6784\u5efa\u5de5\u5177Maven Project\u3001Spring Boot\u7248\u672c1.3.6\u4ee5\u53ca\u4e00\u4e9b\u5de5\u7a0b\u57fa\u672c\u4fe1\u606f\uff0c\u70b9\u51fb&ldquo;Switch to the full version.&rdquo;java \u7248\u672c\u9009\u62e9 1.7 \u6216\u8005\u66f4\u9ad8\u7684\u7248\u672c\uff08\u4e0d\u652f\u63011.6\uff09\uff0c\u53ef\u53c2\u8003\u4e0b\u56fe\u6240\u793a\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"SpringBoot \u521d\u59cb\u5316\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/springboot\/master\/demo1\/1.png\" style=\"width: 869px;height: 411px\" \/>\n<\/p>\n<p>\n\t\u7b2c\u4e09\u6b65\uff0c\u70b9\u51fbGenerate Project\u4e0b\u8f7d\u9879\u76ee\u538b\u7f29\u5305\u3002\n<\/p>\n<p>\n\t\u7b2c\u4e09\u6b65\uff0c\u5c06\u4e0b\u8f7d\u597d\u7684\u9879\u76ee\u538b\u7f29\u5305\u89e3\u538b\u540e\uff0c\u4f7f\u7528eclipse\uff0cImport -&gt; Existing Maven Projects -&gt; Next -&gt;\u9009\u62e9\u89e3\u538b\u540e\u7684\u6587\u4ef6\u5939-&gt; Finsh\uff0cOK done!\n<\/p>\n<p>\n\t\u5373\uff0c\u628a\u9879\u76ee\u5bfc\u5165\u8fdb Eclipse \u4e2d\u3002\u6700\u540e\u7684\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\u56fe\u6240\u793a\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"SpringBoot \u9879\u76ee\u7ed3\u6784\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/springboot\/master\/demo1\/2.png\" style=\"width: 803px;height: 417px\" \/>\n<\/p>\n<p>\n\tSpring Boot \u7684\u9879\u76ee\u7ed3\u6784\u5171\u4e09\u4e2a\u6587\u4ef6\uff0c\u548c\u666e\u901a\u7684 Maven \u521b\u5efa\u7684 SpringMVC \u7684\u9879\u76ee\u4e00\u81f4\u3002\n<\/p>\n<p>\n\t\u5230\u73b0\u5728\u4e00\u4e2a\u7b80\u5355\u7684 SpringBoot \u9879\u76ee\u5df2\u7ecf\u521b\u5efa\u5b8c\u6bd5\u4e86\u3002@SpringBootApplication \u8fd9\u4e2a\u6ce8\u89e3\u7684\u7c7b\uff0c\u5c31\u662f SpringBoot \u9879\u76ee\u7684\u5165\u53e3\u3002\u8fd0\u884c main \u65b9\u6cd5\u5373\u53ef\u542f\u52a8 SpringBoot \u9879\u76ee\u3002\n<\/p>\n<p>\n\t\u6211\u4eec\u53ef\u4ee5\u5728 src\/main\/java \u4e0b\u521b\u5efa\u4e00\u4e9b\u65b0\u5305\uff0c\u4ee5\u5b9e\u73b0 SpringMVC \u7684\u529f\u80fd\u3002\n<\/p>\n<ul>\n<li>\n\t\tcom.xttblog.controller \u653e\u7f6e Controller \u63a7\u5236\u5668\u7c7b\n\t<\/li>\n<li>\n\t\tcom.xttblog.domain \u6216 com.xttblog.model \u653e\u7f6e\u5b9e\u4f53\u7c7b\uff08Entity\uff09\n\t<\/li>\n<li>\n\t\tcom.xttblog.service \u4e3b\u8981\u662f\u653e\u7f6e\u4e1a\u52a1\u7c7b\u4ee3\u7801\uff0c\u548c SpringMVC \u4e2d\u7684\u4e00\u81f4\u3002\n\t<\/li>\n<li>\n\t\tcom.xttblog.dao \u6216\u8005 com.xttblog.repository \u653e\u7f6e\u6570\u636e\u8bbf\u95ee\u5c42\uff0c\u5373\u6301\u4e45\u5c42\n\t<\/li>\n<\/ul>\n<p>\n\t\u73b0\u5728\u770b\u770b SpringBoot \u662f\u4e0d\u662f\u548c SpringMVC \u5f88\u50cf\uff0c\u751a\u81f3\u662f\u4e00\u6837\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u8bf4\u975e\u8981\u6709\u70b9\u533a\u522b\uff0c\u90a3\u4e5f\u662f\u6709\u7684\u3002\n<\/p>\n<p>\n\t\u5728 SpringMVC \u4e2d\uff0c\u6211\u4eec\u8fd8\u591a\u5c11\u9700\u8981\u914d\u7f6e\u4e00\u4e0b Bean\uff0cSpringBoot \u4e2d\u57fa\u672c\u4e0d\u9700\u8981\u914d\u7f6e bean\u4e86\u3002\u53e6\u5916 SpringMVC \u4e2d\u7684 src\/main\/webapp \u4e0b\u653e\u7f6e\u7684\u662f jsp\u3001html\u7b49\u5fae\u535a\u9875\u9762\u3002\u5728 SpringBoot \u4e2d\uff0c\u5b83\u4eec\u5219\u9700\u8981\u653e\u5728 src\/main\/resources \u4e0b\u9762\u3002SpringBoot \u63a8\u8350\u4f7f\u7528 thymeleaf \u6a21\u677f\u5f15\u64ce\uff0c\u800c\u4e0d\u662f jsp\u3001html\u7b49\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6211\u4eec\u4ee5\u540e\u518d\u8bf4\u3002\n<\/p>\n<p>\n\t\u597d\u4e86\u5173\u4e8e SpringBoot \u9879\u76ee\u7684\u521b\u5efa\u5c31\u5230\u8fd9\u91cc\uff0c\u81f3\u4e8e Springboot \u7684 web \u9879\u76ee\u6211\u4eec\u4e0b\u7bc7\u6587\u7ae0\u5728\u8bb2\u89e3\u3002\u6700\u540e\u611f\u5174\u8da3\u7684\u670b\u53cb\uff0c\u53ef\u4ee5\u5173\u6ce8\u6211\u7684\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u56de\u590d\u52a0\u7fa4\uff0c\u52a0\u5165\u7fa4\u804a\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2659\">\u4f7f\u7528 Maven \u521b\u5efa SpringBoot \u9879\u76ee<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u4e00\u7bc7\u7684\u6587\u7ae0\u6709\u7f51\u53cb\u7ed9\u6211\u79c1\u4fe1\u8bf4\u6709\u4e9b\u7b80\u5355\u4e86\uff0c\u8ba9\u6211\u518d\u6765\u4e00\u4e2a SpringBoot \u5165\u95e8\u7bc7\uff0c\u4e8e\u662f\u4fbf\u4e86\u6709\u8fd9\u7bc7\u6587\u7ae0\u3002 \u5176\u5b9e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-2659","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2659"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2659\/revisions"}],"predecessor-version":[{"id":2660,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2659\/revisions\/2660"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}