{"id":190,"date":"2026-06-04T22:01:14","date_gmt":"2026-06-04T14:01:14","guid":{"rendered":"https:\/\/www.linerun.com.cn\/?p=190"},"modified":"2026-06-04T22:01:56","modified_gmt":"2026-06-04T14:01:56","slug":"001-spring-boot%e6%98%af%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%85%8d%e7%bd%ae%e7%9a%84","status":"publish","type":"post","link":"https:\/\/www.linerun.com.cn\/index.php\/2026\/06\/04\/001-spring-boot%e6%98%af%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%85%8d%e7%bd%ae%e7%9a%84\/","title":{"rendered":"001-Spring Boot\u662f\u5982\u4f55\u5b9e\u73b0\u81ea\u52a8\u914d\u7f6e\u7684?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Spring Boot \u81ea\u52a8\u914d\u7f6e\u7684\u6838\u5fc3\u5c31\u662f@EnableAutoConfiguration \u6ce8\u89e3\uff0c\u5b83\u901a\u8fc7 @Import \u5f15\u5165AutoconfigurationImportselector , \u8fd9\u4e2a\u7c7b\u4f1a\u53bb\u626b\u63cf classpath \u4e0b\u6240\u6709jar \u5305\u91cc\u7684 META-INF\/spring.factories \u6587\u4ef6,\u627e\u51fa\u91cc\u9762\u58f0\u660e\u7684\u81ea\u52a8\u914d\u7f6e\u7c7b\uff0c\u7136\u540e\u6839\u636e\u6761\u4ef6\u6ce8\u89e3\u51b3\u5b9a\u54ea\u4e9b\u914d\u7f6e\u8981\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6574\u4e2a\u6d41\u7a0b\u662f\u8fd9\u6837\u7684: Spring Boot \u542f\u52a8\u65f6,@SpringBootApplication \u91cc\u5305\u542b\u7684 @EnableAutoConfiguration \u751f\u6548,\u89e6\u53d1AutoConfigurationlmportSelector \u53bb\u8bfb\u53d6 spring.factories,\u62ff\u5230\u4e00\u5806\u5019\u9009\u914d\u7f6e\u7c7b\uff0c\u7136\u540e\u9010\u4e2a\u68c0\u67e5\u8fd9\u4e9b\u7c7b\u4e0a\u7684@ConditionalOnClass\u3001 @ConditionalOnMissingBean\u3001 @ConditionalonProperty \u8fd9\u4e9b\u6761\u4ef6\u6ce8\u89e3,\u53ea\u6709\u6761\u4ef6\u5168\u90e8\u6ee1\u8db3\u7684\u914d\u7f6e\u7c7b\u624d\u4f1a\u771f\u6b63\u52a0\u8f7d\uff0c\u5f80\u5bb9\u5668\u91cc\u6ce8\u518cBean\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u5982\u4f60\u5f15\u5165\u4e86 spring-boot-starter-web,classpath \u91cc\u5c31\u6709\u4e86 Tomcat \u548c Spring MVC \u7684\u7c7b,\u8fd9\u65f6\u5019WebMvcAutoConfiguration \u7684 @ConditionalOnClass \u6761\u4ef6\u5c31\u6ee1\u8db3\u4e86\uff0c\u81ea\u52a8\u5e2e\u4f60\u914d\u597d DispatcherServlet\u3001 \u89c6\u56fe\u89e3\u6790\u5668\u8fd9\u4e9b\u7ec4\u4ef6\uff0c\u4e0d\u7528\u4f60\u624b\u52a8\u5199\u4e00\u884cXML\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot \u81ea\u52a8\u914d\u7f6e\u7684\u6838\u5fc3\u5c31\u662f@EnableAutoConfiguration \u6ce8\u89e3\uff0c\u5b83\u901a\u8fc7 @I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-spring"],"_links":{"self":[{"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":2,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linerun.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}