{"id":6393,"date":"2024-07-23T17:25:27","date_gmt":"2024-07-23T09:25:27","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6393"},"modified":"2024-07-23T17:25:27","modified_gmt":"2024-07-23T09:25:27","slug":"spring-%e5%92%8c-springboot-%e5%85%b3%e7%b3%bb%e5%92%8c%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6393","title":{"rendered":"Spring \u548c SpringBoot \u5173\u7cfb\u548c\u533a\u522b"},"content":{"rendered":"<blockquote>\n<p>\u975e\u539f\u521b\u3001ChatGPT \u95ee\u7b54\u751f\u6210<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/docs.spring.io\/spring-boot\/reference\/features\/profiles.html\">https:\/\/docs.spring.io\/spring-boot\/reference\/features\/profiles.html<\/a><\/p>\n<p>Spring \u548c Spring Boot \u662f\u4e24\u4e2a\u7d27\u5bc6\u76f8\u5173\u7684\u6846\u67b6\uff0c\u5b83\u4eec\u5728\u73b0\u4ee3 Java \u5e94\u7528\u5f00\u53d1\u4e2d\u90fd\u5360\u636e\u7740\u91cd\u8981\u7684\u4f4d\u7f6e\u3002\u4e86\u89e3\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u548c\u533a\u522b\u6709\u52a9\u4e8e\u66f4\u597d\u5730\u4f7f\u7528\u5b83\u4eec\u6765\u5f00\u53d1\u9ad8\u6548\u3001\u53ef\u7ef4\u62a4\u7684\u5e94\u7528\u3002<\/p>\n<h3>Spring \u6846\u67b6<\/h3>\n<p><strong>Spring \u6846\u67b6<\/strong> \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5f00\u6e90\u6846\u67b6\uff0c\u65e8\u5728\u7b80\u5316 Java \u4f01\u4e1a\u7ea7\u5e94\u7528\u7684\u5f00\u53d1\u3002\u5176\u6838\u5fc3\u529f\u80fd\u5305\u62ec\u4f9d\u8d56\u6ce8\u5165\uff08DI\uff09\u3001\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff08AOP\uff09\u3001\u58f0\u660e\u5f0f\u4e8b\u52a1\u7ba1\u7406\u548c\u5404\u79cd\u4f01\u4e1a\u7ea7\u670d\u52a1\u652f\u6301\u3002<\/p>\n<h4>\u6838\u5fc3\u6a21\u5757\uff1a<\/h4>\n<ol>\n<li><strong>Spring Core<\/strong>\uff1a\u5305\u542b IoC \u5bb9\u5668\u548c\u4f9d\u8d56\u6ce8\u5165\u673a\u5236\uff0c\u662f Spring \u7684\u57fa\u7840\u6a21\u5757\u3002<\/li>\n<li><strong>Spring AOP<\/strong>\uff1a\u63d0\u4f9b\u9762\u5411\u5207\u9762\u7f16\u7a0b\u529f\u80fd\uff0c\u7528\u4e8e\u5206\u79bb\u4e1a\u52a1\u903b\u8f91\u4e2d\u7684\u6a2a\u5207\u5173\u6ce8\u70b9\u3002<\/li>\n<li><strong>Spring MVC<\/strong>\uff1a\u7528\u4e8e\u6784\u5efa\u57fa\u4e8e Web \u7684\u5e94\u7528\uff0c\u63d0\u4f9b Model-View-Controller \u67b6\u6784\u3002<\/li>\n<li><strong>Spring JDBC \u548c ORM<\/strong>\uff1a\u7b80\u5316\u4e0e\u6570\u636e\u5e93\u7684\u4ea4\u4e92\uff0c\u652f\u6301 JDBC \u548c\u5404\u79cd ORM \u6846\u67b6\uff08\u5982 Hibernate\uff09\u3002<\/li>\n<li><strong>Spring Test<\/strong>\uff1a\u63d0\u4f9b\u5bf9 Spring \u7ec4\u4ef6\u7684\u5355\u5143\u6d4b\u8bd5\u548c\u96c6\u6210\u6d4b\u8bd5\u652f\u6301\u3002<\/li>\n<\/ol>\n<h3>Spring Boot<\/h3>\n<p><strong>Spring Boot<\/strong> \u662f\u57fa\u4e8e Spring \u6846\u67b6\u7684\u4e00\u4e2a\u5b50\u9879\u76ee\uff0c\u65e8\u5728\u7b80\u5316 Spring \u5e94\u7528\u7684\u5f00\u53d1\u548c\u90e8\u7f72\u3002\u5b83\u901a\u8fc7\u63d0\u4f9b\u4e00\u7ec4\u7ea6\u5b9a\u4f18\u4e8e\u914d\u7f6e\u7684\u9ed8\u8ba4\u8bbe\u7f6e\uff0c\u4f7f\u5f00\u53d1\u8005\u80fd\u591f\u5feb\u901f\u6784\u5efa\u751f\u4ea7\u7ea7\u7684 Spring \u5e94\u7528\u3002<\/p>\n<h4>\u5173\u952e\u7279\u6027\uff1a<\/h4>\n<ol>\n<li><strong>\u81ea\u52a8\u914d\u7f6e<\/strong>\uff1a\u6839\u636e\u9879\u76ee\u4e2d\u7684\u4f9d\u8d56\u548c\u914d\u7f6e\uff0c\u81ea\u52a8\u914d\u7f6e Spring \u5e94\u7528\u7684\u5e38\u7528\u7ec4\u4ef6\u3002<\/li>\n<li><strong>\u8d77\u6b65\u4f9d\u8d56\uff08Starters\uff09<\/strong>\uff1a\u4e00\u7ec4\u65b9\u4fbf\u7684\u4f9d\u8d56\u63cf\u8ff0\u7b26\uff0c\u7528\u4e8e\u7b80\u5316 Maven \u6216 Gradle \u4e2d\u7684\u4f9d\u8d56\u7ba1\u7406\u3002<\/li>\n<li><strong>\u5d4c\u5165\u5f0f\u670d\u52a1\u5668<\/strong>\uff1a\u652f\u6301\u5d4c\u5165\u5f0f Tomcat\u3001Jetty\u3001Undertow \u7b49\uff0c\u4f7f\u5f97\u5e94\u7528\u53ef\u4ee5\u6253\u5305\u6210\u53ef\u6267\u884c\u7684 JAR \u6587\u4ef6\uff0c\u5e76\u81ea\u5e26\u670d\u52a1\u5668\u8fd0\u884c\u3002<\/li>\n<li><strong>Spring Boot CLI<\/strong>\uff1a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u7528 Groovy \u8fdb\u884c\u5feb\u901f\u539f\u578b\u5f00\u53d1\u3002<\/li>\n<li><strong>Actuator<\/strong>\uff1a\u63d0\u4f9b\u751f\u4ea7\u5c31\u7eea\u7684\u529f\u80fd\uff0c\u5982\u76d1\u63a7\u3001\u5ea6\u91cf\u3001\u5065\u5eb7\u68c0\u67e5\u7b49\u3002<\/li>\n<\/ol>\n<h3>Spring \u548c Spring Boot \u7684\u5173\u7cfb<\/h3>\n<ol>\n<li><strong>\u7ee7\u627f\u548c\u6269\u5c55<\/strong>\uff1aSpring Boot \u6784\u5efa\u5728 Spring \u6846\u67b6\u4e4b\u4e0a\uff0c\u5b83\u7ee7\u627f\u4e86 Spring \u7684\u6838\u5fc3\u529f\u80fd\uff0c\u5e76\u6269\u5c55\u4e86\u4e00\u4e9b\u989d\u5916\u7684\u7279\u6027\u4ee5\u7b80\u5316\u5f00\u53d1\u3002<\/li>\n<li><strong>\u7b80\u5316\u914d\u7f6e<\/strong>\uff1aSpring Boot \u901a\u8fc7\u81ea\u52a8\u914d\u7f6e\u548c\u7ea6\u5b9a\u4f18\u4e8e\u914d\u7f6e\u7684\u539f\u5219\uff0c\u5927\u5927\u51cf\u5c11\u4e86 Spring \u5e94\u7528\u7684\u914d\u7f6e\u548c\u6837\u677f\u4ee3\u7801\u3002<\/li>\n<li><strong>\u5f00\u53d1\u6548\u7387<\/strong>\uff1aSpring Boot \u63d0\u4f9b\u4e86\u4e00\u4e9b\u5f00\u53d1\u5de5\u5177\u548c\u5185\u5d4c\u7684\u670d\u52a1\u5668\uff0c\u4f7f\u5f97\u5f00\u53d1\u3001\u6d4b\u8bd5\u548c\u90e8\u7f72\u53d8\u5f97\u66f4\u52a0\u9ad8\u6548\u548c\u5feb\u6377\u3002<\/li>\n<\/ol>\n<h3>Spring \u548c Spring Boot \u7684\u533a\u522b<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u7279\u6027<\/th>\n<th>Spring<\/th>\n<th>Spring Boot<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\u914d\u7f6e\u65b9\u5f0f<\/strong><\/td>\n<td>\u9700\u8981\u5927\u91cf\u7684 XML \u6216 Java \u914d\u7f6e<\/td>\n<td>\u901a\u8fc7\u81ea\u52a8\u914d\u7f6e\u548c\u7ea6\u5b9a\u4f18\u4e8e\u914d\u7f6e\uff0c\u6781\u5c11\u7684\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td><strong>\u542f\u52a8\u65f6\u95f4<\/strong><\/td>\n<td>\u9700\u8981\u624b\u52a8\u914d\u7f6e\u670d\u52a1\u5668\u548c\u5176\u4ed6\u7ec4\u4ef6<\/td>\n<td>\u5185\u5d4c\u670d\u52a1\u5668\uff0c\u542f\u52a8\u65f6\u95f4\u66f4\u5feb<\/td>\n<\/tr>\n<tr>\n<td><strong>\u590d\u6742\u5ea6<\/strong><\/td>\n<td>\u914d\u7f6e\u548c\u7ba1\u7406\u8f83\u4e3a\u590d\u6742<\/td>\n<td>\u7b80\u5316\u914d\u7f6e\u548c\u4f9d\u8d56\u7ba1\u7406\uff0c\u964d\u4f4e\u590d\u6742\u5ea6<\/td>\n<\/tr>\n<tr>\n<td><strong>\u9879\u76ee\u7ed3\u6784<\/strong><\/td>\n<td>\u9700\u8981\u624b\u52a8\u914d\u7f6e\u9879\u76ee\u7ed3\u6784\u548c\u4f9d\u8d56<\/td>\n<td>\u63d0\u4f9b\u8d77\u6b65\u4f9d\u8d56\u548c\u9879\u76ee\u7ed3\u6784\u6a21\u677f<\/td>\n<\/tr>\n<tr>\n<td><strong>\u76d1\u63a7\u548c\u7ba1\u7406<\/strong><\/td>\n<td>\u9700\u8981\u989d\u5916\u914d\u7f6e\u76d1\u63a7\u548c\u7ba1\u7406\u5de5\u5177<\/td>\n<td>\u5185\u7f6e Actuator \u63d0\u4f9b\u76d1\u63a7\u548c\u7ba1\u7406\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td><strong>\u5f00\u53d1\u5de5\u5177<\/strong><\/td>\n<td>\u65e0\u7279\u5b9a\u5f00\u53d1\u5de5\u5177<\/td>\n<td>\u63d0\u4f9b CLI \u548c DevTools \u7b49\u5f00\u53d1\u5de5\u5177<\/td>\n<\/tr>\n<tr>\n<td><strong>\u6784\u5efa\u548c\u90e8\u7f72<\/strong><\/td>\n<td>\u9700\u8981\u989d\u5916\u914d\u7f6e\u6784\u5efa\u548c\u90e8\u7f72\u5de5\u5177<\/td>\n<td>\u63d0\u4f9b\u6253\u5305\u4e3a\u53ef\u6267\u884c JAR \u6587\u4ef6\u7684\u529f\u80fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u603b\u7ed3<\/h3>\n<ul>\n<li><strong>Spring \u6846\u67b6<\/strong> \u662f\u4e00\u4e2a\u5168\u9762\u7684 Java \u4f01\u4e1a\u7ea7\u5f00\u53d1\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u6a21\u5757\uff0c\u4f46\u914d\u7f6e\u548c\u7ba1\u7406\u76f8\u5bf9\u590d\u6742\u3002<\/li>\n<li><strong>Spring Boot<\/strong> \u662f\u5bf9 Spring \u6846\u67b6\u7684\u6269\u5c55\uff0c\u65e8\u5728\u7b80\u5316 Spring \u5e94\u7528\u7684\u5f00\u53d1\u3001\u914d\u7f6e\u548c\u90e8\u7f72\uff0c\u901a\u8fc7\u81ea\u52a8\u914d\u7f6e\u548c\u7ea6\u5b9a\u4f18\u4e8e\u914d\u7f6e\u7684\u7406\u5ff5\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u3002<\/li>\n<\/ul>\n<p>\u7406\u89e3 Spring \u548c Spring Boot \u7684\u5173\u7cfb\u548c\u533a\u522b\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u6839\u636e\u9879\u76ee\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6\uff0c\u5e76\u5145\u5206\u5229\u7528\u5b83\u4eec\u7684\u4f18\u52bf\u6765\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u4ee3\u7801\u8d28\u91cf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u975e\u539f\u521b\u3001ChatGPT \u95ee\u7b54\u751f\u6210 https:\/\/docs.spring.io\/spring-boot\/ref&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6393\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[123],"tags":[133,132],"class_list":["post-6393","post","type-post","status-publish","format-standard","hentry","category-123","tag-spring","tag-springboot"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6393"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6393\/revisions"}],"predecessor-version":[{"id":6394,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6393\/revisions\/6394"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}