use of com.ctrip.framework.apollo.util.http.HttpClient in project apollo by ctripcorp.
the class ApolloClientLongPollingExtensionInitializer method initialize.
@Override
public void initialize(ApolloClientProperties apolloClientProperties, Binder binder, BindHandler bindHandler) {
WebClient.Builder webClientBuilder = WebClient.builder();
List<ApolloClientWebClientCustomizerFactory> factories = ServiceBootstrap.loadAllOrdered(ApolloClientWebClientCustomizerFactory.class);
if (!CollectionUtils.isEmpty(factories)) {
for (ApolloClientWebClientCustomizerFactory factory : factories) {
WebClientCustomizer webClientCustomizer = factory.createWebClientCustomizer(apolloClientProperties, binder, bindHandler, this.log, this.bootstrapContext);
if (webClientCustomizer != null) {
webClientCustomizer.customize(webClientBuilder);
}
}
}
HttpClient httpClient = new ApolloWebClientHttpClient(webClientBuilder.build());
ApolloConfigDataInjectorCustomizer.registerIfAbsent(HttpClient.class, () -> httpClient);
}
Aggregations