本文整理汇总了Java中org.springframework.boot.web.client.RestTemplateCustomizer类的典型用法代码示例。如果您正苦于以下问题:Java RestTemplateCustomizer类的具体用法?Java RestTemplateCustomizer怎么用?Java RestTemplateCustomizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestTemplateCustomizer类属于org.springframework.boot.web.client包,在下文中一共展示了RestTemplateCustomizer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: restTemplateBuilder
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public RestTemplateBuilder restTemplateBuilder() {
RestTemplateBuilder builder = new RestTemplateBuilder();
HttpMessageConverters converters = this.messageConverters.getIfUnique();
if (converters != null) {
builder = builder.messageConverters(converters.getConverters());
}
List<RestTemplateCustomizer> customizers = this.restTemplateCustomizers
.getIfAvailable();
if (!CollectionUtils.isEmpty(customizers)) {
customizers = new ArrayList<RestTemplateCustomizer>(customizers);
AnnotationAwareOrderComparator.sort(customizers);
builder = builder.customizers(customizers);
}
return builder;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:WebClientAutoConfiguration.java
示例2: restTemplateShouldApplyCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Test
public void restTemplateShouldApplyCustomizer() throws Exception {
load(RestTemplateCustomizerConfig.class, RestTemplateConfig.class);
RestTemplate restTemplate = this.context.getBean(RestTemplate.class);
RestTemplateCustomizer customizer = this.context
.getBean(RestTemplateCustomizer.class);
verify(customizer).customize(restTemplate);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:WebClientAutoConfigurationTests.java
示例3: breakBuilderOnNextCall
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
private void breakBuilderOnNextCall(RestTemplateBuilder builder) {
builder.additionalCustomizers(new RestTemplateCustomizer() {
@Override
public void customize(RestTemplate restTemplate) {
throw new IllegalStateException();
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:WebClientAutoConfigurationTests.java
示例4: restTemplateCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
public RestTemplateCustomizer restTemplateCustomizer() {
return mock(RestTemplateCustomizer.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:WebClientAutoConfigurationTests.java
示例5: ribbonClientRestTemplateCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
/**
* Customize the RestTemplate to use Ribbon load balancer to resolve service endpoints
*/
@Bean
public RestTemplateCustomizer ribbonClientRestTemplateCustomizer(
final RibbonClientHttpRequestFactory ribbonClientHttpRequestFactory) {
return new RestTemplateCustomizer() {
@Override
public void customize(RestTemplate restTemplate) {
restTemplate.setRequestFactory(ribbonClientHttpRequestFactory);
}
};
}
开发者ID:hotblac,项目名称:spanners,代码行数:14,代码来源:RestClientConfig.java
示例6: TestRestTemplateConfig
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
public TestRestTemplateConfig(
final ObjectProvider<HttpMessageConverters> messageConverters,
final ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
super(messageConverters, restTemplateCustomizers);
}
开发者ID:backpaper0,项目名称:spring-boot-vue-simple-sample,代码行数:6,代码来源:JsonSampleControllerTest.java
示例7: okhttp3RestTemplateCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
@Order(2)
@ConditionalOnBean(OkHttp3ClientHttpRequestFactory.class)
public RestTemplateCustomizer okhttp3RestTemplateCustomizer(OkHttp3ClientHttpRequestFactory requestFactory) {
return restTemplate -> restTemplate.setRequestFactory(requestFactory);
}
开发者ID:freefair,项目名称:okhttp-spring-boot,代码行数:7,代码来源:OkHttpRestTemplateAutoConfiguration.java
示例8: RestTemplateConfiguration
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
public RestTemplateConfiguration(
ObjectProvider<HttpMessageConverters> messageConverters,
ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
this.messageConverters = messageConverters;
this.restTemplateCustomizers = restTemplateCustomizers;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:WebClientAutoConfiguration.java
示例9: testRestTemplateCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
public RestTemplateCustomizer testRestTemplateCustomizer() {
return b -> b.setErrorHandler(errorHandler);
}
开发者ID:spring-io,项目名称:initializr,代码行数:5,代码来源:InitializrStatsAutoConfigurationTests.java
示例10: mockMvcCustomizer
import org.springframework.boot.web.client.RestTemplateCustomizer; //导入依赖的package包/类
@Bean
RestTemplateCustomizer mockMvcCustomizer(BeanFactory beanFactory) {
return template -> template.setRequestFactory(
beanFactory.getBean(MockMvcClientHttpRequestFactory.class));
}
开发者ID:spring-io,项目名称:initializr,代码行数:6,代码来源:AbstractInitializrControllerIntegrationTests.java
注:本文中的org.springframework.boot.web.client.RestTemplateCustomizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论