Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 7dd1f10

Browse files
ttddyysdeleuze
authored andcommitted
Add a type hint for SimpleClientHttpRequestFactory
The `connectTimeout` `readTimeout` and `bufferRequestBody` methods on `RestTemplateBuilder` uses reflection to access underlying `ClientHttpRequestFactory` implementation class. Currently, type hints for `HttpComponentsClientHttpRequestFactory` and `OkHttp3ClientHttpRequestFactory` exist, but the fallback request factory, `SimpleClientHttpRequestFactory` hint doesn't exist. Therefore, when `RestTemplate` doesn't detect either commons-client or okhttp, it falls back to the `SimpleClientHttpRequestFactory` and the reflective access fails to find the class. This PR simply adds a hint to expose `SimpleClientHttpRequestFactory`, so that above reflective methods on `RestTemplateBuilder` will have access to it. Fixes gh-954
1 parent acaa88d commit 7dd1f10

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-native-configuration/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactoryHints.java

+3
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
okhttp3.OkHttpClient.class,
1313
org.springframework.http.client.OkHttp3ClientHttpRequestFactory.class
1414
}))
15+
@NativeHint(trigger = org.springframework.http.client.SimpleClientHttpRequestFactory.class, types = @TypeHint(types = {
16+
org.springframework.http.client.SimpleClientHttpRequestFactory.class
17+
}))
1518
public class ClientHttpRequestFactoryHints implements NativeConfiguration {
1619
}

0 commit comments

Comments
 (0)