question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ExchangeStrategies custom codec's reader and writer are not registered

See original GitHub issue

Affects: 5.2.6.RELEASE


I added my custom encoder and decoder like following.

ExchangeStrategies
    .empty()
    .codecs(configurer -> {
        configurer.defaultCodecs().maxInMemorySize(properties.getMaxInMemorySize());
        configurer.customCodecs().registerWithDefaultConfig(encoder);
        configurer.customCodecs().registerWithDefaultConfig(decoder);
    })
    .build();

But there is no messageWriters when writing body with BodyInserts.fromValue(). It seems that encoder and decoder that I added above are not registered at ExchangeStrategies.

I think following code block has bug. Why put all readers and writers from this to other? It seems that this and other are swapped.

https://github.com/spring-projects/spring-framework/blob/90ccabd60bfe24249b3c4cbe43a25ffd0efa6eba/spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java#L144-L149

If it is a bug, I would like to create a PR. 😃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dlsrb6342commented, May 28, 2020

@sbrannen Please have a look #25149

1reaction
sbrannencommented, May 28, 2020

Yes, that looks like a bug.

Feel free to submit a PR with the fix, and please make sure to include a test that fails before the fix and passes afterwards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set WebClient.Builder.exchangeStrategies() without losing ...
This works, but feels a bit strange. The question is: do I need to include the jackson/objectMapper configuration like this, or is there...
Read more >
Web on Reactive Stack - Spring
Custom codecs. Applications can register custom codecs for supporting additional media types, or specific behaviors that are not supported by ...
Read more >
[GitHub] [maven-indexer] dependabot[bot] opened a new pull ...
... </ul> <h2>:beetle: Bug Fixes</h2> <ul> <li>ExchangeStrategies custom codec's reader & writer are not registered <a ...
Read more >
spring-projects/spring-boot - Gitter
defaultCodecs ().maxInMemorySize(1024 * 10)).build(); WebClient webClient = WebClient.builder().exchangeStrategies(exchangeStrategies).build();. dylmeadows.
Read more >
Custom codecs - DataStax Java Driver
using a codec: if already registered: row.get("columnName", MyCustomType.class) ... To write a custom codec, implement the TypeCodec interface.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found