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

ExchangeStrategies custom codec's reader & writer are not registered #25149

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -142,10 +142,10 @@ protected static final class DefaultCustomCodecs implements CustomCodecs {
* @since 5.1.12
*/
DefaultCustomCodecs(DefaultCustomCodecs other) {
other.typedReaders.putAll(this.typedReaders);
other.typedWriters.putAll(this.typedWriters);
other.objectReaders.putAll(this.objectReaders);
other.objectWriters.putAll(this.objectWriters);
this.typedReaders.putAll(other.typedReaders);
this.typedWriters.putAll(other.typedWriters);
this.objectReaders.putAll(other.objectReaders);
this.objectWriters.putAll(other.objectWriters);
}

@Override
Expand Down
Expand Up @@ -285,7 +285,7 @@ public void encoderDecoderOverrides() {
}

@Test
public void cloneCustomCodecs() {
public void cloneEmptyCustomCodecs() {
this.configurer.registerDefaults(false);
CodecConfigurer clone = this.configurer.clone();

Expand All @@ -300,6 +300,22 @@ public void cloneCustomCodecs() {
assertThat(clone.getWriters().size()).isEqualTo(2);
}

@Test
public void cloneCustomCodecs() {
CodecConfigurer from = new TestCodecConfigurer();
from.registerDefaults(false);
from.customCodecs().register(new Jackson2JsonEncoder());
from.customCodecs().register(new Jackson2JsonDecoder());
from.customCodecs().register(new ServerSentEventHttpMessageReader());
from.customCodecs().register(new ServerSentEventHttpMessageWriter());

CodecConfigurer clone = from.clone();
assertThat(from.getReaders().size()).isEqualTo(2);
assertThat(from.getWriters().size()).isEqualTo(2);
assertThat(clone.getReaders().size()).isEqualTo(2);
assertThat(clone.getWriters().size()).isEqualTo(2);
}

@Test
public void cloneDefaultCodecs() {
CodecConfigurer clone = this.configurer.clone();
Expand Down