我是靠谱客的博主 飘逸西装,这篇文章主要介绍springboot引用gson包出现的问题,现在分享给大家,希望可以做个参考。

springboot引用gson包后启动时出现下面错误信息

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:/Users/xu/.m2/repository/com/google/code/gson/gson/2.2.2/gson-2.2.2.jar!/com/google/gson/GsonBuilder.class
    jar:file:/Users/xu/work/wrapper/libs/gson-2.2.2.jar!/com/google/gson/GsonBuilder.class

It was loaded from the following location:

    file:/Users/xu/.m2/repository/com/google/code/gson/gson/2.2.2/gson-2.2.2.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder


Process finished with exit code 1
 

解决办法:

将pom中gson版本改完2.6解决。

复制代码
1
2
3
4
5
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.6</version> </dependency>

最后

以上就是飘逸西装最近收集整理的关于springboot引用gson包出现的问题的全部内容,更多相关springboot引用gson包出现内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部