本文整理汇总了Java中org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer类的典型用法代码示例。如果您正苦于以下问题:Java RestTemplateCustomizer类的具体用法?Java RestTemplateCustomizer怎么用?Java RestTemplateCustomizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestTemplateCustomizer类属于org.springframework.cloud.client.loadbalancer包,在下文中一共展示了RestTemplateCustomizer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadBalancedRestTemplate
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
RestTemplate template = Mockito.mock(RestTemplate.class);
Mockito.when(template.exchange(Mockito.anyString(),
Mockito.anyObject(), Mockito.anyObject(), Mockito.eq(String.class))).thenReturn(new ResponseEntity<String>(BODY, HttpStatus.OK));
return template;
}
示例2: restTemplateCustomizer
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
public RestTemplateCustomizer restTemplateCustomizer(final RibbonClientHttpRequestFactory requestFactory) {
return restTemplate -> {
restTemplate.setRequestFactory(requestFactory);
addConverters(restTemplate);
};
}
示例3: loadBalancedRestTemplate
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@Qualifier("loadBalancedRestTemplate")
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
RestTemplate restTemplate = new RestTemplate();
customizer.customize(restTemplate);
return restTemplate;
}
示例4: loadBalancedRestTemplate
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
RestTemplate restTemplate = new RestTemplate();
customizer.customize(restTemplate);
return restTemplate;
}
示例5: loadBalancedRestTemplate
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
return null;
}
示例6: loadBalancedRestTemplate
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@LoadBalanced
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
return rest(customizer);
}
示例7: restTemplateCustomizer
import org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
public RestTemplateCustomizer restTemplateCustomizer(
final RibbonClientHttpRequestFactory ribbonClientHttpRequestFactory) {
return restTemplate -> restTemplate.setRequestFactory(ribbonClientHttpRequestFactory);
}