Spring Boot provides a number of “Starters” that let you add jars to your classpath. Our sample application has already used spring-boot-starter-parent in the parent section of the POM. The spring-boot-starter-parent is a special starter that provides useful Maven defaults. It also provides a dependency-management section so that you can omit version tags for “blessed” dependencies.
SpringBoot提供一許多“Starter”,讓您添加jar包到類路徑(classpath)中。 我們例子應(yīng)用程序在POM文件的parent節(jié)點(diǎn)中使用(繼承)了spring-boot-starter-parent。 spring-boot-starter-parent是一個(gè)特殊的“starter”, 提供了有用的Maven默認(rèn)值。 同時(shí)提供了dependency-management,因此您可以省略“blessed”依賴包的SpringBoot提供一許多“Starter”,讓您添加jar包到類路徑(classpath)中。 我們例子應(yīng)用程序中Pom文件(繼承的)父POM文件中使用了spring-boot-starter-parent。 spring-boot-starter-parent是一個(gè)特殊的“starter”, 提供了有用的Maven默認(rèn)值。 同時(shí)還提供了dependency-management節(jié)點(diǎn),因此您可以(在引用依賴
包時(shí))省略“blessed”依賴的標(biāo)簽。
Other “Starters” provide dependencies that you are likely to need when developing a specific type of application. Since we are developing a web application, we add a spring-boot-starter-web dependency. Before that, we can look at what we currently have by running the following command:
其他“Starter”提供了您可能在開(kāi)發(fā)一個(gè)特定類型的應(yīng)用程序時(shí)需要的依賴。 由于我們要開(kāi)發(fā)一個(gè)Web應(yīng)用程序,因此我們添加了spring-boot-starter-web依賴。 在此之前, 我們能看一下當(dāng)前有的依賴,通過(guò)運(yùn)行以下命令:
The mvn dependency:tree command prints a tree representation of your project dependencies. You can see that spring-boot-starter-parent provides no dependencies by itself. To add the necessary dependencies, edit your pom.xml and add the spring-boot-starter-web dependency immediately below the parent section:
If you run mvn dependency:tree again, you see that there are now a number of additional dependencies, including the Tomcat web server and Spring Boot itself.
更多建議: