W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
The second class-level annotation is @EnableAutoConfiguration
. This annotation tells Spring Boot to “guess” how you want to configure Spring, based on the jar dependencies that you have added. Since spring-boot-starter-web
added Tomcat and Spring MVC, the auto-configuration assumes that you are developing a web application and sets up Spring accordingly.
第二個(gè)類級(jí)別(class-level)的注解是@EnableAutoConfiguration
。這個(gè)注解告訴SpringBoot“猜測(cè)”您想怎樣基于您添加的jar包依賴配置Spring。 由于spring-boot-starter-web
中添加了Tomcat和Spring MVC(的依賴), 所以自動(dòng)配置將假設(shè)您在開(kāi)發(fā)一個(gè)Web應(yīng)用程序,并相應(yīng)的設(shè)置Spring。
Starters and Auto-configuration
啟動(dòng)器(Starter)和自動(dòng)配置(Auto-configuration)
Auto-configuration is designed to work well with “Starters”, but the two concepts are not directly tied. You are free to pick and choose jar dependencies outside of the starters. Spring Boot still does its best to auto-configure your application.
自動(dòng)配置設(shè)計(jì)用于和“啟動(dòng)器(Starter)”一起很好的工作,但這兩個(gè)概念沒(méi)有直接聯(lián)系。 您可以自由選擇啟動(dòng)器之外的jar依賴項(xiàng)。SpringBoot仍然盡力自動(dòng)配置您的應(yīng)用程序。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: