本文整理汇总了Java中org.springframework.web.reactive.function.client.WebClient.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.Builder方法的具体用法?Java WebClient.Builder怎么用?Java WebClient.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.reactive.function.client.WebClient
的用法示例。
在下文中一共展示了WebClient.Builder方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multipleWebClientBuilders
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Test
public void multipleWebClientBuilders() {
ConfigurableApplicationContext context = init(TwoWebClientBuilders.class);
final Map<String, WebClient.Builder> webClientBuilders = context
.getBeansOfType(WebClient.Builder.class);
assertThat(webClientBuilders).hasSize(2);
TwoWebClientBuilders.Two two = context.getBean(TwoWebClientBuilders.Two.class);
assertThat(two.loadBalanced).isNotNull();
assertLoadBalanced(two.loadBalanced);
assertThat(two.nonLoadBalanced).isNotNull();
assertThat(getFilters(two.nonLoadBalanced)).isNullOrEmpty();
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:17,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java
示例2: postProcessAfterInitialization
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Override public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
if (bean instanceof WebClient) {
WebClient webClient = (WebClient) bean;
return webClient
.mutate()
.filter(new TraceExchangeFilterFunction(this.beanFactory))
.build();
} else if (bean instanceof WebClient.Builder) {
WebClient.Builder webClientBuilder = (WebClient.Builder) bean;
return webClientBuilder.filter(new TraceExchangeFilterFunction(this.beanFactory));
}
return bean;
}
示例3: loadBalancedWebClientInitializer
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Bean
public SmartInitializingSingleton loadBalancedWebClientInitializer(
final List<WebClientCustomizer> customizers) {
return () -> {
for (WebClient.Builder webClientBuilder : getBuilders()) {
for (WebClientCustomizer customizer : customizers) {
customizer.customize(webClientBuilder);
}
}
};
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:12,代码来源:ReactiveLoadBalancerAutoConfiguration.java
示例4: webClientBuilderGetsLoadBalancerInterceptor
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Test
public void webClientBuilderGetsLoadBalancerInterceptor() {
ConfigurableApplicationContext context = init(OneWebClientBuilder.class);
final Map<String, WebClient.Builder> webClientBuilders = context
.getBeansOfType(WebClient.Builder.class);
assertThat(webClientBuilders).isNotNull().hasSize(1);
WebClient.Builder webClientBuilder = webClientBuilders.values().iterator().next();
assertThat(webClientBuilder).isNotNull();
assertLoadBalanced(webClientBuilder);
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:13,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java
示例5: ReactiveClient
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
public ReactiveClient(String url, Consumer<WebClient.Builder> configurator, SSLContext sslContext) throws MalformedURLException {
this(urlWithoutCredentials(url),
StringUtils.split(new URL(url).getUserInfo(),":")[0],
StringUtils.split(new URL(url).getUserInfo(),":")[1],
configurator,
sslContext);
}
示例6: ProxyController
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
public ProxyController(ApplicationRepository applicationRepository,
AccessTokenService accessTokenService, WebClient.Builder builder) {
this.applicationRepository = applicationRepository;
this.accessTokenService = accessTokenService;
this.webClient = builder.build();
}
示例7: webClientBuilder
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Bean
WebClient.Builder webClientBuilder() {
return WebClient.builder();
}
示例8: getBuilders
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
public List<WebClient.Builder> getBuilders() {
return webClientBuilders;
}
示例9: assertLoadBalanced
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
private void assertLoadBalanced(WebClient.Builder webClientBuilder) {
List<ExchangeFilterFunction> filters = getFilters(webClientBuilder);
assertThat(filters).hasSize(1);
ExchangeFilterFunction interceptor = filters.get(0);
assertThat(interceptor).isInstanceOf(LoadBalancerExchangeFilterFunction.class);
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:7,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java
示例10: getFilters
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<ExchangeFilterFunction> getFilters(WebClient.Builder builder) {
return (List<ExchangeFilterFunction>) ReflectionTestUtils.getField(builder, "filters");
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:5,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java
示例11: loadBalancedWebClientBuilder
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Bean
@LoadBalanced
WebClient.Builder loadBalancedWebClientBuilder() {
return WebClient.builder();
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:6,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java
示例12: webClientBuilder
import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Primary
@Bean
WebClient.Builder webClientBuilder() {
return WebClient.builder();
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:6,代码来源:ReactiveLoadBalancerAutoConfigurationTests.java