IDE中Gson衝突解決

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-01-22 17:03:27.514 ERROR 6220 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

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:/Program%20Files%20(x86)/maven3.6.0/repository/com/google/code/gson/gson/2.1/gson-2.1.jar!/com/google/gson/GsonBuilder.class

It was loaded from the following location:

    file:/D:/Program%20Files%20(x86)/maven3.6.0/repository/com/google/code/gson/gson/2.1/gson-2.1.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

 

 

 

解決方法:

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    <exclusions>
        <exclusion>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </exclusion>
    </exclusions>
</dependency>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章