SpringBoot中pom引入gson异常

 在pom中引入gson依赖,启动spring boot项目中报错

Description:

An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist. Its class, com.google.gson.GsonBuilder, is available from the following locations:

    jar:file:/D:/work/code/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/com/google/gson/GsonBuilder.class

It was loaded from the following location:

    file:/D:/work/code/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
开始以为jar包冲突,查询各个pom发现并没有重复依赖,最后将2.2.4版本换为2.6版本后启动正常


com.google.code.gson
gson
2.6

转载于:https://www.cnblogs.com/cat-fish6/p/11383025.html

你可能感兴趣的:(SpringBoot中pom引入gson异常)