package com.njzscloud.common.core.http;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 */
@Configuration
@EnableConfigurationProperties(HttpClientProperties.class)
public class HttpClientAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public HttpClient httpClient(HttpClientProperties httpClientProperties) {
        return new HttpClient(httpClientProperties);
    }

    @Bean
    public HttpClientDecorator httpClientDecorator(HttpClient httpClient) {
        return new HttpClientDecorator(httpClient);
    }
}
