- Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtype: enhancementA general enhancementA general enhancement
Milestone
Description
When using RestTemplateBuilder in a native-image, for example in this code:
private final RestTemplateBuilder restTemplateBuilder; // ... RestTemplate restTemplate = this.restTemplateBuilder .setConnectTimeout(Duration.ofSeconds(5)) .setReadTimeout(Duration.ofSeconds(5)) .build();then this fails in a native image with this stacktrace:
java.lang.IllegalStateException: Request factory class org.springframework.http.client.SimpleClientHttpRequestFactory does not have a suitable setConnectTimeout method at org.springframework.boot.web.client.RestTemplateBuilder$RequestFactoryCustomizer.findMethod(RestTemplateBuilder.java:782) at org.springframework.boot.web.client.RestTemplateBuilder$RequestFactoryCustomizer.setConnectTimeout(RestTemplateBuilder.java:761) at org.springframework.boot.web.client.RestTemplateBuilder$RequestFactoryCustomizer.accept(RestTemplateBuilder.java:736) at org.springframework.boot.web.client.RestTemplateBuilder.buildRequestFactory(RestTemplateBuilder.java:656) at org.springframework.boot.web.client.RestTemplateBuilder.configure(RestTemplateBuilder.java:614) at org.springframework.boot.web.client.RestTemplateBuilder.build(RestTemplateBuilder.java:589) at com.example.resttemplate.CLR.http(CLR.java:33) at com.example.resttemplate.CLR.run(CLR.java:26) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:752) at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at com.example.resttemplate.RestTemplateApplication.main(RestTemplateApplication.java:13) This can be observed in https://ci.spring.io/teams/spring-aot-smoke-tests/pipelines/spring-aot-smoke-tests-1.0.x/jobs/rest-template/builds/1
Metadata
Metadata
Assignees
Labels
theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtype: enhancementA general enhancementA general enhancement