package com.njzscloud.common.http.config;

import com.njzscloud.common.http.HttpClient;
import com.njzscloud.common.http.HttpClientDecorator;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * http客户端自动配置
 */
@Configuration
@EnableConfigurationProperties(HttpClientProperties.class)
public class HttpClientAutoConfiguration {

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

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