RestTemplate в весенней загрузке 3.3.0JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 RestTemplate в весенней загрузке 3.3.0

Сообщение Anonymous »

Этот код совместим с Spring Boot 2.7.10. Какие изменения мне нужно внести в код ниже, чтобы сделать его совместимым с Spring Boot 3.3.0?
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.nio.charset.StandardCharsets;

@Component
public class RestConfig {
@Bean(name = "restTemplate")
private RestTemplate restTemplate() {
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create()
.setMaxConnPerRoute(40)
.setMaxConnTotal(150)
.build());

httpRequestFactory.setConnectionRequestTimeout(5000);
httpRequestFactory.setConnectTimeout(3000);
httpRequestFactory.setReadTimeout(50000);

RestTemplate restTemplate = new RestTemplate(httpRequestFactory);

restTemplate.getMessageConverters()
.add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));

return restTemplate;
}
}


Подробнее здесь: https://stackoverflow.com/questions/793 ... boot-3-3-0
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»