org.zodiac.autoconfigure.internal.ReactiveInternalAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.internal;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnAppDiscoveryEnabled;
import org.zodiac.core.application.AppContext;
import org.zodiac.core.bootstrap.discovery.ReactiveAppDiscoveryClient;
import org.zodiac.core.internal.http.ReactiveAppInternalHttpClient;
@SpringBootConfiguration
@ConditionalOnAppDiscoveryEnabled
@ConditionalOnWebApplication(type = Type.REACTIVE)
@ConditionalOnClass(value = {org.springframework.web.client.RestTemplate.class})
public class ReactiveInternalAutoConfiguration {
public ReactiveInternalAutoConfiguration() {
super();
}
@Bean
@ConditionalOnMissingBean
protected ReactiveAppInternalHttpClient internalHttpClient(ReactiveAppDiscoveryClient discoveryClient, AppContext appContext,
ObjectProvider restTemplateProvider) {
return new ReactiveAppInternalHttpClient(discoveryClient, appContext, restTemplateProvider.getIfAvailable());
}
}