Skip to content

HTTP interface client should not set a default blockingTimeout value and instead let the underlying HTTP client determine the behavior #30248

Closed as not planned
@pmverma

Description

@pmverma

Affects: Spring Boot 3.0.5 / Spring Framework 6.0.7


As mentioned in the title, it seems the webclient timeout value does not work when using the HTTP interface.
But the same timeout value works when using the webclient directly as below.

    @EventListener
    public void onStartup(ApplicationStartedEvent event) {
        // Non-blocking, working fine
        event.getApplicationContext().getBean(WebClient.class)
                .get()
                .uri("http://localhost:8080/test")
                .retrieve().bodyToMono(String.class)
                .subscribe(System.out::println);

        // Blocking, working fine
        String result = event.getApplicationContext().getBean(WebClient.class)
                .get()
                .uri("http://localhost:8080/test")
                .retrieve().bodyToMono(String.class)
                .block();
        System.out.println(result);

        // Blocking but with HttpInterface, is failing
        SampleApi sampleApi = event.getApplicationContext().getBean(SampleApi.class);
        System.out.println(sampleApi.get().getStatusCode());
    }

I have added a minimal sample application that demonstrates the above issue.
https://github.com/pmverma/demo-http-interface-webclient-timeout

All codes are in a single file DemoHttpInterfaceWebclientTimeoutApplication.java

Regards,
Mohan

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions