【发布时间】:2017-06-17 03:06:22
【问题描述】:
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));
但不幸的是,ClientRequest.GET 方法不适用于我添加到项目中的 gradle 依赖项。下面是我正在使用的 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 是否在任何存储库的某个地方发布?
【问题讨论】:
标签: java spring-boot spring-webflux