{"id":8237,"date":"2023-11-28T20:19:29","date_gmt":"2023-11-28T12:19:29","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8237"},"modified":"2023-12-06T10:11:21","modified_gmt":"2023-12-06T02:11:21","slug":"springboot-zi-dong-sao-miao-le-jie-ma","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-zi-dong-sao-miao-le-jie-ma\/","title":{"rendered":"SpringBoot\u81ea\u52a8\u626b\u63cf\u4e86\u89e3\u5417\uff1f"},"content":{"rendered":"<p>\u5728Spring Boot\u4e2d\uff0c\u81ea\u52a8\u626b\u63cf\u662f\u4e00\u79cd\u901a\u8fc7\u7c7b\u8def\u5f84\u626b\u63cf\u6765\u53d1\u73b0\u548c\u6ce8\u518c\u7ec4\u4ef6\u7684\u673a\u5236\u3002\u8fd9\u79cd\u673a\u5236\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\u5e76\u52a0\u8f7d\u6807\u6709\u7279\u5b9a\u6ce8\u89e3\u7684\u7c7b\uff0c\u4f8b\u5982<code>@Component<\/code>\u3001<code>@Service<\/code>\u3001<code>@Repository<\/code>\u7b49\u3002Spring Boot\u501f\u52a9Spring\u6846\u67b6\u7684\u7ec4\u4ef6\u626b\u63cf\u673a\u5236\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u65e0\u9700\u663e\u5f0f\u914d\u7f6e\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u6ce8\u518c\u5404\u79cd\u7ec4\u4ef6\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5173\u4e8eSpring Boot\u81ea\u52a8\u626b\u63cf\u7684\u4e00\u4e9b\u8981\u70b9\uff1a<\/p>\n<ol>\n<li>\n<strong>\u9ed8\u8ba4\u7684\u7ec4\u4ef6\u626b\u63cf\u8def\u5f84\uff1a<\/strong> Spring Boot\u9ed8\u8ba4\u4f1a\u626b\u63cf\u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u6240\u5728\u7684\u5305\u53ca\u5176\u5b50\u5305\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u4f4d\u4e8e<code>com.example<\/code>\u5305\u4e0b\uff0cSpring Boot\u4f1a\u81ea\u52a8\u626b\u63cf<code>com.example<\/code>\u53ca\u5176\u5b50\u5305\u4e2d\u7684\u7ec4\u4ef6\u3002\n<\/li>\n<li>\n<strong>\u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u7684\u4f4d\u7f6e\uff1a<\/strong> \u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u662f\u6307\u5305\u542b<code>public static void main(String[] args)<\/code>\u65b9\u6cd5\u7684\u7c7b\uff0c\u901a\u5e38\u662f\u9879\u76ee\u7684\u5165\u53e3\u7c7b\u3002\u5728Spring Boot\u9879\u76ee\u4e2d\uff0c\u5b83\u901a\u5e38\u4f4d\u4e8e\u5305\u7684\u6839\u76ee\u5f55\u3002\n<\/li>\n<li>\n<strong>\u6ce8\u89e3\u6807\u8bb0\u7ec4\u4ef6\uff1a<\/strong> Spring Boot\u901a\u8fc7\u626b\u63cf\u7c7b\u8def\u5f84\u4e0a\u6240\u6709\u6807\u6709<code>@Component<\/code>\u53ca\u5176\u884d\u751f\u6ce8\u89e3\u7684\u7c7b\u6765\u6ce8\u518c\u7ec4\u4ef6\u3002\u8fd9\u4e9b\u6ce8\u89e3\u5305\u62ec<code>@Service<\/code>\u3001<code>@Repository<\/code>\u3001<code>@Controller<\/code>\u7b49\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u6ce8\u89e3\u5c06\u7c7b\u6807\u8bb0\u4e3aSpring\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\uff0c\u4ece\u800c\u8ba9Spring Boot\u80fd\u591f\u81ea\u52a8\u53d1\u73b0\u5e76\u8fdb\u884c\u5b9e\u4f8b\u5316\u3002\n<\/li>\n<li>\n<strong><code>@SpringBootApplication<\/code>\u6ce8\u89e3\uff1a<\/strong> \u5728Spring Boot\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u901a\u5e38\u4f7f\u7528<code>@SpringBootApplication<\/code>\u6ce8\u89e3\u6807\u8bb0\u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u3002\u8fd9\u4e2a\u6ce8\u89e3\u5305\u542b\u4e86<code>@ComponentScan<\/code>\u6ce8\u89e3\uff0c\u5176\u9ed8\u8ba4\u503c\u4e3a\u4e3b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u6240\u5728\u7684\u5305\u53ca\u5176\u5b50\u5305\u3002\u8fd9\u610f\u5473\u7740<code>@SpringBootApplication<\/code>\u9690\u5f0f\u542f\u7528\u4e86\u81ea\u52a8\u626b\u63cf\u3002<\/p>\n<pre><code class=\"language-java\">@SpringBootApplication\npublic class MyApplication {\n    public static void main(String[] args) {\n        SpringApplication.run(MyApplication.class, args);\n    }\n}\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u603b\u7684\u6765\u8bf4\uff0cSpring Boot\u7684\u81ea\u52a8\u626b\u63cf\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u52a0\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u7ec4\u7ec7\u9879\u76ee\u4e2d\u7684\u7ec4\u4ef6\uff0c\u51cf\u5c11\u4e86\u7e41\u7410\u7684\u914d\u7f6e\u5de5\u4f5c\u3002\u901a\u8fc7\u4f7f\u7528\u5408\u9002\u7684\u6ce8\u89e3\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u7ec4\u4ef6\u7684\u81ea\u52a8\u53d1\u73b0\u548c\u6ce8\u518c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Spring Boot\u4e2d\uff0c\u81ea\u52a8\u626b\u63cf\u662f\u4e00\u79cd\u901a\u8fc7\u7c7b\u8def\u5f84\u626b\u63cf\u6765\u53d1\u73b0\u548c\u6ce8\u518c\u7ec4\u4ef6\u7684\u673a\u5236\u3002\u8fd9\u79cd\u673a\u5236\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\u5e76\u52a0\u8f7d\u6807\u6709 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-8237","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=8237"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8237\/revisions"}],"predecessor-version":[{"id":16589,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8237\/revisions\/16589"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8237"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}