Springboot整合Gson報錯問題解決過程
更新時間:2020年06月04日 09:50:31 作者:等茶的茶
這篇文章主要介紹了Springboot整合Gson報錯問題解決過程,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
在Springboot 中依賴Gson,項目啟動時報錯:
*************************** APPLICATION FAILED TO START *************************** 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:/D:/8_maven/mvnrepo/com/google/code/gson/gson/2.5/gson-2.5.jar!/com/google/gson/GsonBuilder.class It was loaded from the following location: file:/D:/8_maven/mvnrepo/com/google/code/gson/gson/2.5/gson-2.5.jar Action: Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
解決辦法:
將pom中依賴的Gson版本更換為2.6以上即可
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.6</version> </dependency>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
SpringBoot實現(xiàn)License認證(只校驗有效期)的詳細過程
License也就是版權(quán)許可證書,一般用于收費軟件給付費用戶提供的訪問許可證明,這篇文章主要介紹了SpringBoot實現(xiàn)License認證(只校驗有效期),需要的朋友可以參考下2024-04-04JDK生成WebService客戶端代碼以及調(diào)用方式
WebService 是一種跨編程語言和跨操作系統(tǒng)平臺的遠程調(diào)用技術(shù),下面這篇文章主要給大家介紹了關(guān)于JDK生成WebService客戶端代碼以及調(diào)用方式的相關(guān)資料,文中通過代碼介紹的非常詳細,需要的朋友可以參考下2024-08-08Springboot實現(xiàn)發(fā)送郵件及注冊激活步驟
為了方便郵件發(fā)送功能的使用,我們用郵件發(fā)送功能實現(xiàn)用戶注冊,實現(xiàn)步驟大概就是進行用戶注冊同時發(fā)送一封激活郵件,郵件里附帶激活鏈接,關(guān)于Springboot發(fā)送郵件注冊激活功能的實現(xiàn)參考下本文吧2021-06-06詳解APP微信支付(java后臺_統(tǒng)一下單和回調(diào))
這篇文章主要介紹了APP微信支付(java后臺_統(tǒng)一下單和回調(diào)),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-05-05Spring?Boot虛擬線程Webflux在JWT驗證和MySQL查詢性能比較
這篇文章主要為大家介紹了Spring Boot虛擬線程與Webflux在JWT驗證和MySQL查詢上的性能比較,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-09-09