package org.dromara.system.api.utils;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.http.HttpClient;
import java.time.Duration;

/**
 * @Author 铁憨憨
 * @Date 2025/7/18 10:16
 * @Version 1.0
 *
 * HttpClient 设计为可重用、线程安全的组件，其内部维护了连接池等资源，适合在多个接口调用中共享使用,所以交给Spring Bean 管理
 */
@Configuration
public class HttpClientConfig {
    @Bean
    public HttpClient httpClient() {
        return HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(10))
            .build();
    }
}
