【发布时间】:2019-03-19 01:38:03
【问题描述】:
在运行我的 Spring Boot 应用程序时,我收到以下错误:
尝试调用方法org.springframework.web.reactive.function.client.WebClient.builder()Lorg/springframework/web/reactive/function/client/WebClient$Builder; but it does not exist. Its class, org.springframework.web.reactive.function.client.WebClient, is available from the following locations:
jar:file:/C:/Users/Wicia/.m2/repository/org/springframework/spring-web-reactive/5.0.0.M4/spring-web-reactive-5.0.0.M4.jar!/org/springframework/web/reactive/function/client/WebClient.class
它是从以下位置加载的:
file:/C:/Users/Wicia/.m2/repository/org/springframework/spring-web-reactive/5.0.0.M4/spring-web-reactive-5.0.0.M4.jar
行动:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.reactive.function.client.WebClient
我发现了一条线索,我应该为所有工件指定通用的 spring 版本(而不是混合它),但是该怎么做呢?
这是我的 pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web-reactive</artifactId>
<version>5.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-cassandra</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
【问题讨论】:
-
你正在使用 Spring Boot... 然后不要乱用版本。为
spring-boot-starter-parent使用一个版本,它应该是您的父级或 pom.xml 中dependencyManagement部分中的导入。所有其他版本将由 Spring Boot 管理。
标签: spring maven spring-boot spring-data