-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Apply codecs auto-configuration to webflux server and webclient #9166
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
Comments
Interesting convo in #9485 |
Probably the same issue |
Some changes are required in Framework to consistently apply codec configuration on both client and server sides, see SPR-15682. |
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClientBuilder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClientBuilder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClientBuilder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClientBuilder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClientBuilder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClient.Builder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit introduces `CodecCustomizer`, a new callback-based interface for customizing the codecs configuration for WebFlux server and client. Instances of those customizers are applied to the `WebClient.Builder` and to the `WebFluxAutoConfiguration` (which deals with both WebFlux and WebFlux.fn). For now, only Jackson codecs are auto-configured, by getting the `ObjectMapper` instance created by Spring Boot. Other codecs can be configured as soon as WebFlux supports those. Closes spring-projectsgh-9166
This commit applies what's been done in spring-projectsgh-9166 for WebFlux client and server, but for the `WebTestClient` auto-configuration. `WebTestClient` can be configured for mock or integration tests and this change applies `CodecCustomizer` beans to the client being built. Closes spring-projectsgh-9577
This commit applies what's been done in spring-projectsgh-9166 for WebFlux client and server, but for the `WebTestClient` auto-configuration. `WebTestClient` can be configured for mock or integration tests and this change applies `CodecCustomizer` beans to the client being built. Closes spring-projectsgh-9577
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)
Apologies, I am looking everywhere in the Spring Boot documentation and I cannot find any reference to how to get the WebTestClient to pick up my custom objectMapper. I am using Spring Boot 2 and my custom object mapper is not being used. Is there specific configuration required? I am assuming this ticket fixed it somehow. Cheers |
If you inject a If it's not the case, please create a new issue with a small repro project I can take a look at. Thanks! |
Hi @bclozel I did what I saw in the other ticket that started this and added:
to my mock setup. |
For Spring MVC, the
HttpMessageConvertersAutoConfiguration
configures the appropriate message converters for the server and the client (RestTemplate
).We should do the same for WebFlux, using
ServerCodecConfigurer
andClientCodecConfigurer
.The text was updated successfully, but these errors were encountered: