I use pretty straightforward configuration of my WebClient:

@Configuration
class Config {

    @Value("${client.baseUrl}")
    private String baseUrl;

    @Bean
    public WebClient webClient() {
        return WebClient.builder()
                .codecs(this::configureCodec)
                .baseUrl(baseUrl)
                .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
                .build();
    }

    private void configureCodec(ClientCodecConfigurer configurer) {
        configurer
                .defaultCodecs()
                .maxInMemorySize(16 * 1024 * 1024);
    }
}

And it works for spring-boot-starter-parent:2.6.7. However as of spring-boot-starter-parent:2.7.8 for huge payloads I get DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144 which is in turn fixed by adding this line to application.properties:

spring.codec.max-in-memory-size=16777216

Neither ClientCodecConfigurer, nor WebClient.Builder.codecs() are deprecated and their JavaDoc as of 2.7.8 says nothing about spring.codec.max-in-memory-size so this seems to be a bug.

However, if it's not an issue then please provide your answer to https://stackoverflow.com/questions/75445977/is-webclient-builder-codecs-ignored-in-spring-boot-2-7

Comment From: wilkinsona

I've commented on your Stack Overflow question. To avoid anyone duplicating effort, I am going to close this issue for now. If we identify that the problem's caused by a bug in Spring Boot we can re-open this issue.

Comment From: CristinaRuscau

hello :) does anyone have this issue with springboot 3.3.x ? I tried with 3.3.0, 3.3.1 and 3.3.2 and I get this issue, I'm setting the max buffer size exactly like in the example above, but still get the exception with the default size. It just doesn't pick it up and I don't know if I should set it somehow differently, as I didn't find any other ways to do this config.

Comment From: scottfrederick

@CristinaRuscau As Andy mentioned in the StackOverflow post that is linked in the original comment, it is difficult to know what is going on without a sample of what you are doing. The best way to get help is to create a StackOverflow question that includes a sample.