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. :)
Comment From: sbrannen
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.
Comment From: sbrannen
This should be backported to 5.1.x as well, but I'm holding off on creating the backport issue with the assumption that a PR from @dlsrb6342 will supersede this issue.
Comment From: sbrannen
@dlsrb6342 Do you think you'll find time to submit the PR in the coming week?
It would be good to have it in place in time for 5.2.7.
Comment From: dlsrb6342
@sbrannen Please have a look #25149
Comment From: sbrannen
Superseded by #25149.