| 1234567891011121314151617 |
- package com.github.jfcloud.common.config;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.http.client.SimpleClientHttpRequestFactory;
- import org.springframework.web.client.RestTemplate;
- @Configuration
- public class RestTemplateConfig {
- @Bean
- public RestTemplate restTemplate() {
- SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
- factory.setConnectTimeout(30000); // 连接超时 30秒
- factory.setReadTimeout(60000); // 读取超时 60秒 (AI推理可能较慢)
- return new RestTemplate(factory);
- }
- }
|