org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer Java Examples

The following examples show how to use org.springframework.cloud.client.loadbalancer.RestTemplateCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 6 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #2
Source File: RestTemplateCircuitBreakerAutoConfiguration.java    From spring-cloud-formula with Apache License 2.0 6 votes vote down vote up
@Bean
public SmartInitializingSingleton loadBalancedRestTemplateInitializer2(
        final ObjectProvider<List<RestTemplateCustomizer>> restTemplateCustomizers) {
    return () -> {
        logger.info("RestTemplateResilienceAutoConfiguration init2");
        for (RestTemplate restTemplate : RestTemplateCircuitBreakerAutoConfiguration.this.restTemplates) {
            List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors();
            logger.info("RestTemplate init2 start,interceptor size:" + interceptors.size());
            //for (ClientHttpRequestInterceptor interceptor : interceptors) {
            //logger.info("RestTemplate init2 interceptor ing:"+interceptor.getClass().getCanonicalName());
            //}
            //logger.info("RestTemplate init2 Customizer end");
            ClientHttpRequestInterceptor interceptor1 = new RestTemplateCircuitBreakerInterceptor
                    (circuitBreakerCore);
            interceptors.add(0, interceptor1);
            restTemplate.setInterceptors(interceptors);
            logger.info("RestTemplate init2 end,add CircuitBreaker interceptor");
        }
    };
}
 
Example #3
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #4
Source File: SecurityConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #5
Source File: SecurityConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #6
Source File: MyfeedAutoConfig.java    From myfeed with Apache License 2.0 5 votes vote down vote up
@Bean
public RestTemplateCustomizer restTemplateCustomizer(final RibbonClientHttpRequestFactory requestFactory) {
    return restTemplate -> {
        restTemplate.setRequestFactory(requestFactory);
        addConverters(restTemplate);
    };
}
 
Example #7
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #8
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #9
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #10
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #11
Source File: MicroserviceSecurityConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
@Qualifier("loadBalancedRestTemplate")
   public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
       RestTemplate restTemplate = new RestTemplate();
       customizer.customize(restTemplate);
       return restTemplate;
   }
 
Example #12
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #13
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #14
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #15
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #16
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #17
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #18
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #19
Source File: MyfeedAutoConfig.java    From myfeed with Apache License 2.0 4 votes vote down vote up
@Bean
   @LoadBalanced
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
	return rest(customizer);
}
 
Example #20
Source File: SecurityBeanOverrideConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #21
Source File: SecurityBeanOverrideConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #22
Source File: SecurityBeanOverrideConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}
 
Example #23
Source File: SecurityBeanOverrideConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
@Primary
public RestTemplate loadBalancedRestTemplate(RestTemplateCustomizer customizer) {
    return null;
}