Skip to content
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

Add config property for CodecConfigurer.maxInMemorySize in WebFlux #18828

Closed
bclozel opened this issue Oct 31, 2019 · 2 comments
Closed

Add config property for CodecConfigurer.maxInMemorySize in WebFlux #18828

bclozel opened this issue Oct 31, 2019 · 2 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Oct 31, 2019

As of spring-projects/spring-framework#23884, Spring Framework supports configuring buffering limits on the webflux codecs (both client and server). We should add a configuration property for that, once we've decided what to do with #18827 first.

@egor-ryashin
Copy link

egor-ryashin commented Jan 17, 2020

maxInMemorySize is not available in:

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.2.3.RELEASE</version>

This won't compile:

ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
                .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(1024 * 10)).build();
WebClient webClient = WebClient.builder().exchangeStrategies(exchangeStrategies).build();

I wonder why the issue was closed?

@bclozel
Copy link
Member Author

bclozel commented Jan 18, 2020

Hello @egor-ryashin, this issue is about adding a new spring.codec.max-in-memory-size configuration property in Spring Boot. This new property is available now, you can use it like this:

spring.codec.max-in-memory-size=1MB

Doing so will configure the default codecs to use this maximum size, and you can then configure your WebClient using the WebClient.Builder instance auto-configured by Spring Boot:

@Service
public class MyService {

    private final WebClient webClient;

    public MyService(WebClient.Builder webClientBuilder) {
        this.webClient = webClientBuilder.baseUrl("https://example.org").build();
    }

}

The code you're pointing at is not part of Spring Boot, but is actually Spring Framework. This code is used by Spring Boot for this feature and is tested, as shown in the linked commit on this issue.

Is your project overriding the Spring Framework version? Maybe there's a corrupt JAR in your local repository?

In any case, could you create a new issue with a project reproducing the problem?

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

2 participants