Java 类org.springframework.boot.web.client.RestTemplateCustomizer 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebClientAutoConfiguration.java   
@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;
}
项目:spring-boot-concourse    文件:WebClientAutoConfiguration.java   
@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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebClientAutoConfigurationTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebClientAutoConfigurationTests.java   
private void breakBuilderOnNextCall(RestTemplateBuilder builder) {
    builder.additionalCustomizers(new RestTemplateCustomizer() {

        @Override
        public void customize(RestTemplate restTemplate) {
            throw new IllegalStateException();
        }

    });
}
项目:spring-boot-concourse    文件:WebClientAutoConfigurationTests.java   
@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);
}
项目:spring-boot-concourse    文件:WebClientAutoConfigurationTests.java   
private void breakBuilderOnNextCall(RestTemplateBuilder builder) {
    builder.additionalCustomizers(new RestTemplateCustomizer() {

        @Override
        public void customize(RestTemplate restTemplate) {
            throw new IllegalStateException();
        }

    });
}
项目:spanners    文件:RestClientConfig.java   
/**
 * 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);
        }
    };
}
项目:spring-boot-vue-simple-sample    文件:JsonSampleControllerTest.java   
public TestRestTemplateConfig(
        final ObjectProvider<HttpMessageConverters> messageConverters,
        final ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
    super(messageConverters, restTemplateCustomizers);
}
项目:okhttp-spring-boot    文件:OkHttpRestTemplateAutoConfiguration.java   
@Bean
@Order(2)
@ConditionalOnBean(OkHttp3ClientHttpRequestFactory.class)
public RestTemplateCustomizer okhttp3RestTemplateCustomizer(OkHttp3ClientHttpRequestFactory requestFactory) {
    return restTemplate -> restTemplate.setRequestFactory(requestFactory);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebClientAutoConfiguration.java   
public RestTemplateConfiguration(
        ObjectProvider<HttpMessageConverters> messageConverters,
        ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
    this.messageConverters = messageConverters;
    this.restTemplateCustomizers = restTemplateCustomizers;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:WebClientAutoConfigurationTests.java   
@Bean
public RestTemplateCustomizer restTemplateCustomizer() {
    return mock(RestTemplateCustomizer.class);
}
项目:spring-boot-concourse    文件:WebClientAutoConfiguration.java   
public RestTemplateConfiguration(
        ObjectProvider<HttpMessageConverters> messageConverters,
        ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
    this.messageConverters = messageConverters;
    this.restTemplateCustomizers = restTemplateCustomizers;
}
项目:spring-boot-concourse    文件:WebClientAutoConfigurationTests.java   
@Bean
public RestTemplateCustomizer restTemplateCustomizer() {
    return mock(RestTemplateCustomizer.class);
}
项目:okhttp-spring-boot    文件:OkHttpRestTemplateAutoConfiguration.java   
@Bean
@Order(2)
@ConditionalOnBean(OkHttp3ClientHttpRequestFactory.class)
public RestTemplateCustomizer okhttp3RestTemplateCustomizer(OkHttp3ClientHttpRequestFactory requestFactory) {
    return restTemplate -> restTemplate.setRequestFactory(requestFactory);
}
项目:initializr    文件:InitializrStatsAutoConfigurationTests.java   
@Bean
public RestTemplateCustomizer testRestTemplateCustomizer() {
    return b -> b.setErrorHandler(errorHandler);
}
项目:initializr    文件:InitializrAutoConfigurationTests.java   
@Bean
public RestTemplateCustomizer testRestTemplateCustomizer() {
    return b -> b.setErrorHandler(errorHandler);
}
项目:initializr    文件:AbstractInitializrControllerIntegrationTests.java   
@Bean
RestTemplateCustomizer mockMvcCustomizer(BeanFactory beanFactory) {
    return template -> template.setRequestFactory(
            beanFactory.getBean(MockMvcClientHttpRequestFactory.class));
}