当前位置: 首页>>代码示例>>Java>>正文


Java WebClient.Builder方法代码示例

本文整理汇总了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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:15,代码来源:TraceWebClientBeanPostProcessor.java

示例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);
}
 
开发者ID:rabbitmq,项目名称:hop,代码行数:8,代码来源:ReactiveClient.java

示例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();
}
 
开发者ID:making,项目名称:spring-boot-actuator-dashboard,代码行数:7,代码来源:ProxyController.java

示例7: webClientBuilder

import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
@Bean
WebClient.Builder webClientBuilder() {
	return WebClient.builder();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:5,代码来源:WebClientTests.java

示例8: getBuilders

import org.springframework.web.reactive.function.client.WebClient; //导入方法依赖的package包/类
public List<WebClient.Builder> getBuilders() {
	return webClientBuilders;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:4,代码来源:ReactiveLoadBalancerAutoConfiguration.java

示例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


注:本文中的org.springframework.web.reactive.function.client.WebClient.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。