今天启动项目的时候报这个错误,网上搜索,大多数都说是版本问题,然后在pom.xml文件里面加入这些jackson依赖:
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.10.5</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.10.5</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.10.5</version> </dependency>
再次启动,不报错了,但是又出现了另外一个问题,就行项目启动之后自动停止,网上搜索,说是没导入“spring-boot-starter-web”包,于是又在pom.xml中导入依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
再次启动,能正常启动了,想着是不是上一个原因也是因为没加入“spring-boot-starter-web”包,于是就把上面加的jackson依赖移除,再次启动,也能正常启动。