Spring web 反应式中有一个类WebClient and ClientRequest
。如果我们查看以下文档,则可以使用 WebClient 来使用 ClientRequest。
WebClient client = WebClient.create(new ReactorClientHttpConnector());
ClientRequest<Void> request = ClientRequest.GET("http://example.com/resource").build();
Mono<String> result = client
.exchange(request)
.then(response -> response.bodyToMono(String.class));
但不幸的是,我添加到项目中的 gradle 依赖项无法使用ClientRequest.GET方法。以下是我正在使用的 gradle 依赖项:
dependencies {
compile('org.springframework.boot.experimental:spring-boot-starter-web-reactive')
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile('io.reactivex:rxjava')
compile('io.reactivex:rxjava-reactive-streams')
//Spring Test case dependency
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile('io.rest-assured:rest-assured:3.0.1')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
mavenBom "org.springframework.boot.experimental:spring-boot-dependencies-web-reactive:0.1.0.BUILD-SNAPSHOT"
}
}
我找不到 M4 的依赖项。M4 是否在任何存储库的某个地方发布?