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包出现内容请搜索靠谱客的其他文章。
发表评论 取消回复