From b1a3849b270c814382381066cb396e4027e144d6 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Wed, 10 Jul 2019 12:05:36 +0200 Subject: [PATCH] Disable Jackson XML support in RSocket codecs Prior to this commit, having the `spring-boot-starter-rsocket` and the `jackson-dataformat-xml` dependencies on classpath would result in a `ClassCastException` when the RSocket auto-configuration tries to configure Jackson CBOR codecs for RSocket strategies. This commit disables the Jackson XML support for the CBOR codec in RSocket. Fixes gh-17425 --- .../rsocket/RSocketStrategiesAutoConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java index 7db6ddd28f..3274377fa1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java @@ -78,7 +78,7 @@ public class RSocketStrategiesAutoConfiguration { @ConditionalOnBean(Jackson2ObjectMapperBuilder.class) public RSocketStrategiesCustomizer jacksonCborRSocketStrategyCustomizer(Jackson2ObjectMapperBuilder builder) { return (strategy) -> { - ObjectMapper objectMapper = builder.factory(new CBORFactory()).build(); + ObjectMapper objectMapper = builder.createXmlMapper(false).factory(new CBORFactory()).build(); strategy.decoder(new Jackson2CborDecoder(objectMapper, SUPPORTED_TYPES)); strategy.encoder(new Jackson2CborEncoder(objectMapper, SUPPORTED_TYPES)); };