Springboot整合Gson报错问题解决过程
程序员文章站
2022-03-20 17:54:58
在springboot 中依赖gson,项目启动时报错:***************************application failed to start******************...
在springboot 中依赖gson,项目启动时报错:
*************************** application failed to start *************************** description: an attempt was made to call a method that does not exist. the attempt was made from the following location: java.lang.invoke.methodhandlenatives.resolve(native method) the following method did not exist: com.google.gson.gsonbuilder.setlenient()lcom/google/gson/gsonbuilder; the method's class, com.google.gson.gsonbuilder, is available from the following locations: jar:file:/d:/8_maven/mvnrepo/com/google/code/gson/gson/2.5/gson-2.5.jar!/com/google/gson/gsonbuilder.class it was loaded from the following location: file:/d:/8_maven/mvnrepo/com/google/code/gson/gson/2.5/gson-2.5.jar action: correct the classpath of your application so that it contains a single, compatible version of com.google.gson.gsonbuilder
解决办法:
将pom中依赖的gson版本更换为2.6以上即可
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.8.6</version> </dependency>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
上一篇: go:变量和常量
推荐阅读
-
MyEclipse下SpringBoot+JSP整合过程及踩坑
-
springboot整合websocket后运行测试类报错:javax.websocket.server.ServerContainer not available
-
SpringBoot整合mybatis访问时报错Invalid bound statement (not found)
-
Springboot整合freemarker 404问题解决方案
-
Springboot整合Freemarker的实现详细过程
-
Springboot整合RabbitMQ(六):远程过程调用(RPC)
-
SpringBoot整合Swagger2的完整过程记录
-
SpringBoot整合模板引擎过程代码实例
-
Redis—Springboot整合Redisson超卖问题解决
-
详解IDEA中SpringBoot整合Servlet三大组件的过程