Springboot整合Gson报错问题解决过程

网友投稿 875 2023-05-28

Springboot整合Gson报错问题解决过程

在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/mvnrepoZOSrrozY/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以上即可

com.google.code.gson

gson

2.8.6

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Springboot+SpringSecurity+JWT实现用户登录和权限认证示例
下一篇:金融机构转型发展的七重割裂关系
相关文章

 发表评论

暂时没有评论,来抢沙发吧~