首页 > 其他分享 >Springboot中使用GSON报错 An attempt was made to call the method com.google.gson.GsonBuilder.setLenient

Springboot中使用GSON报错 An attempt was made to call the method com.google.gson.GsonBuilder.setLenient

时间:2022-11-07 19:39:53浏览次数:60  
标签:google attempt 2.6 made 报错 GsonBuilder setLenient com gson


错误如下:

 

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:

  ......
 

这种情况是GSON依赖版本不对,换成2.6以上版本即可,如:

 

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>

标签:google,attempt,2.6,made,报错,GsonBuilder,setLenient,com,gson
From: https://blog.51cto.com/u_15753094/5831048

相关文章