gson在springboot中使用时版本问题

如果你的springboot项目启动时报了以下错误,那么恭喜你更换新版的gson即可解决,建议2.6以上

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.4/gson-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.4/gson-2.4.jar


Action:

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

猜你喜欢

转载自blog.csdn.net/weixin_42254857/article/details/82713832