Skip to content

symmetry in the way we specify request factories #33933

Closed as not planned
Closed as not planned
@joshlong

Description

@joshlong
    @Bean
    JdkClientHttpRequestFactory jdkClientHttpRequestFactory() {
        return new JdkClientHttpRequestFactory();
    }

    @Bean
    RestClient restClient(
            JdkClientHttpRequestFactory jdkClientHttpRequestFactory,
            RestClient.Builder builder) {
        return builder
                .requestFactory(jdkClientHttpRequestFactory)
                .build();
    }

    @Bean
    RestTemplate restTemplate(
            JdkClientHttpRequestFactory jdkClientHttpRequestFactory,
            RestTemplateBuilder builder) {
        return builder
                .requestFactory(() -> jdkClientHttpRequestFactory)
                .build();
    }

it would be nice if the ResstClient also took a Supplier<T> and the RestTemplate took a reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions