让一个spring-mvc项目成功跑起来返回json格式数据的最最精简的pom的备忘
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.szq</groupId>
<artifactId>learn</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>learn Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.0.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.6</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>learn</finalName>
</build>
</project>
解释:spring-mvc项目一般只需要导入spring-webmvc依赖即可,其他依赖是会自动导进来的,只需要一个spring-webmvc依赖足以让一个spring-mvc项目跑起来了。一般情况下我们会返回json格式数据,这就需要jackson-databind了,也只需要导入jackson-databind这个就行了,其他的jackson包会自动导进来。