Skip to content

Commit

Permalink
Update to Spring Boot 3.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgrefer committed Nov 5, 2024
1 parent 458e951 commit 40fc0a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io.freefair.gradle.plugins.okhttp.tasks.UploadFile

plugins {
id "org.springframework.boot" version "3.3.4" apply false
id "org.springframework.boot" version "3.3.5" apply false
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "io.freefair.git-version"
id "io.freefair.okhttp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ private OkHttpClient extractClient(RestClient restClient) throws NoSuchFieldExce
ClientHttpRequestFactory requestFactory = (ClientHttpRequestFactory) clientRequestFactoryField.get(restClient);

while (requestFactory instanceof AbstractClientHttpRequestFactoryWrapper) {
Field field = AbstractClientHttpRequestFactoryWrapper.class.getDeclaredField("requestFactory");
field.setAccessible(true);
requestFactory = (ClientHttpRequestFactory) field.get(requestFactory);
requestFactory = ((AbstractClientHttpRequestFactoryWrapper)requestFactory).getDelegate();
}

assertThat(requestFactory).isInstanceOf(OkHttpClientRequestFactory.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import java.lang.reflect.Field;
import java.time.Duration;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -29,7 +28,7 @@ class OkHttpRestTemplateAutoConfigurationTest {
private RestTemplateBuilder restTemplateBuilder;

@Test
void testTimeouts() throws NoSuchFieldException, IllegalAccessException {
void testTimeouts() {
RestTemplate restTemplate = restTemplateBuilder.setConnectTimeout(Duration.ofSeconds(42)).build();

OkHttpClient client = extractClient(restTemplate);
Expand All @@ -39,13 +38,11 @@ void testTimeouts() throws NoSuchFieldException, IllegalAccessException {
assertThat(client.writeTimeoutMillis()).isEqualTo(Duration.ofSeconds(21).toMillis());
}

private OkHttpClient extractClient(RestTemplate restTemplate) throws NoSuchFieldException, IllegalAccessException {
private OkHttpClient extractClient(RestTemplate restTemplate) {
ClientHttpRequestFactory requestFactory = restTemplate.getRequestFactory();

while (requestFactory instanceof AbstractClientHttpRequestFactoryWrapper) {
Field field = AbstractClientHttpRequestFactoryWrapper.class.getDeclaredField("requestFactory");
field.setAccessible(true);
requestFactory = (ClientHttpRequestFactory) field.get(requestFactory);
requestFactory = ((AbstractClientHttpRequestFactoryWrapper)requestFactory).getDelegate();
}

assertThat(requestFactory).isInstanceOf(OkHttpClientRequestFactory.class);
Expand Down

0 comments on commit 40fc0a1

Please sign in to comment.