![](/img/trans.png)
[英]spring-boot-starter-web-reactive + spring-boot-starter-actuator doesn't work together?
[英]spring-boot-starter-web-reactive M4 dependency
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是否在任何存储库中的某个位置发布?
这个Spring Boot启动器取决于当前的Spring Framework 5.0 SNAPSHOT。 WebClient
API是最近发展的, 参考文档应该是最新的 。
现在可以编写您的示例:
WebClient client = WebClient.create("http://example.com/");
Mono<String> result = client
.get("/resource")
.exchange()
.then(response -> response.bodyToMono(String.class));
您需要配置权限存储库。 M4(即里程碑项目)与常规版本不在同一个存储库中。 实际上,Spring为快照发行版提供了单独的存储库。 检查Spring存储库
对于里程碑版本,请使用以下存储库:
buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/milestone' }
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.