2024.12.11(SpringBoot知识点总结)

3.1.2 分析spring-boot-starter-web
按住Ctrl点击pom.xml中的spring-boot-starter-web,跳转到了spring-boot-starter-web的pom.xml,xml配置如下(只摘抄了部分重点配置):


4.0.0

org.springframework.boot
spring-boot-starters
2.0.1.RELEASE

org.springframework.boot
spring-boot-starter-web
2.0.1.RELEASE
Spring Boot Web Starter

<dependencies>
	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter</artifactId>
  		<version>2.0.1.RELEASE</version>
  		<scope>compile</scope>
	</dependency>
	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-json</artifactId>
  		<version>2.0.1.RELEASE</version>
  		<scope>compile</scope>
	</dependency>
	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-tomcat</artifactId>
  		<version>2.0.1.RELEASE</version>
  		<scope>compile</scope>
	</dependency>
	<dependency>
  		<groupId>org.hibernate.validator</groupId>
  		<artifactId>hibernate-validator</artifactId>
  		<version>6.0.9.Final</version>
  		<scope>compile</scope>
	</dependency>
	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-web</artifactId>
  		<version>5.0.5.RELEASE</version>
  		<scope>compile</scope>
	</dependency>
	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-webmvc</artifactId>
  		<version>5.0.5.RELEASE</version>
  		<scope>compile</scope>
	</dependency>
</dependencies>
从上面的spring-boot-starter-web的pom.xml中我们可以发现,spring-boot-starter-web就是将web开发要使用的spring-web、spring-webmvc等坐标进行了“打包”,这样我们的工程只要引入spring-boot-starter-web起步依赖的坐标就可以进行web开发了,同样体现了依赖传递的作用。
posted @ 2025-01-10 23:39  ysd666  阅读(38)  评论(0)    收藏  举报