Skip to content

Auto-configure WebClient.Builder components #9522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bclozel opened this issue Jun 15, 2017 · 1 comment
Closed

Auto-configure WebClient.Builder components #9522

bclozel opened this issue Jun 15, 2017 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jun 15, 2017

In order to apply #9166 to WebClient instances, we need to customize WebClient.Builder instances with Boot's configuration. One could compare this feature with the RestTemplateBuilder, but there are a few differences:

  • WebClient.Builder already exists in webflux
  • WebClient.Builder is stateful, meaning we can't expose it as a singleton component, otherwise further customizations made by Spring developers might be applied in different, unintended, places
  • WebClient.Builder has a clone method
  • WebClient is itself stateless but can expose a new builder instance with its mutate method
  • Spring Boot should apply a few auto-configured customizations on the WebClient.Builder (like codecs), and then give that to developers for further changes
@bclozel bclozel added priority: high type: enhancement A general enhancement labels Jun 15, 2017
@bclozel bclozel added this to the 2.0.0.M3 milestone Jun 15, 2017
@bclozel bclozel self-assigned this Jun 15, 2017
bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 20, 2017
Even if WebFlux' `WebClient` has its own builder API, Spring Boot
provides an extra layer on top of it with `WebClientBuilder`.

This builder interface extends `WebClient.Builder` and provides
an additional method to apply `WebClientCustomizer` instances
to the client being built.

With that infrastructure, Spring Boot can provide a stateless
`WebClient` builder to the application context so that developers
can create `WebClient` instances with Spring Boot conventions
applied automatically.

Closes spring-projectsgh-9522
bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 20, 2017
Even if WebFlux' `WebClient` has its own builder API, Spring Boot
provides an extra layer on top of it with `WebClientBuilder`.

This builder interface extends `WebClient.Builder` and provides
an additional method to apply `WebClientCustomizer` instances
to the client being built.

With that infrastructure, Spring Boot can provide a stateless
`WebClient` builder to the application context so that developers
can create `WebClient` instances with Spring Boot conventions
applied automatically.

Closes spring-projectsgh-9522
bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 21, 2017
Even if WebFlux' `WebClient` has its own builder API, Spring Boot
provides an extra layer on top of it with `WebClientBuilder`.

This builder interface extends `WebClient.Builder` and provides
an additional method to apply `WebClientCustomizer` instances
to the client being built.

With that infrastructure, Spring Boot can provide a stateless
`WebClient` builder to the application context so that developers
can create `WebClient` instances with Spring Boot conventions
applied automatically.

Closes spring-projectsgh-9522
@bclozel
Copy link
Member Author

bclozel commented Jun 22, 2017

The initial attempt to resolve that is about to be rewritten, once SPR-15690 is resolved.

bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 22, 2017
This commit adds a new customizer interface for applying
configuration changes to `WebClient.Builder` beans:
`WebClientCustomizer`.

The new WebClient auto-configuration will make available, as a
prototype scoped bean, `WebClient.Builder` instances.
Once injected, developers can use those to create `WebClient`
instances to be used in their application.

`WebClientCustomizer` beans are sorted according to their
`Order` and then applied to the builder instances.

Closes spring-projectsgh-9522
@bclozel bclozel changed the title Create a WebClientBuilder infrastructure Auto-configure WebClient.Builder components Jun 22, 2017
bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 23, 2017
This commit adds a new customizer interface for applying
configuration changes to `WebClient.Builder` beans:
`WebClientCustomizer`.

The new WebClient auto-configuration will make available, as a
prototype scoped bean, `WebClient.Builder` instances.
Once injected, developers can use those to create `WebClient`
instances to be used in their application.

`WebClientCustomizer` beans are sorted according to their
`Order` and then applied to the builder instances.

Closes spring-projectsgh-9522
@bclozel bclozel closed this as completed in 4ce726b Jul 3, 2017
bclozel added a commit that referenced this issue Jul 7, 2017
This commit adds new reference documentation sections about WebFlux
support in Spring Boot:

* Support for multiple HTTP servers (gh-8403)
* `CodecCustomizer` and JSON codecs (gh-8897, gh-9166)
* `WebClient.Builder` auto-configuration (gh-9522)
* Tests with `@WebFluxTest` (gh-8401)
* `WebTestClient` auto-configuration (gh-8399)
* Support for Thymeleafi and Mustache templating (gh-8124, gh-8648)
* Choose another HTTP server with WebFlux (closes gh-9690)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant