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
pull/17390/head
Brian Clozel 5 years ago
parent 2830847344
commit b1a3849b27

@ -78,7 +78,7 @@ public class RSocketStrategiesAutoConfiguration {
@ConditionalOnBean(Jackson2ObjectMapperBuilder.class) @ConditionalOnBean(Jackson2ObjectMapperBuilder.class)
public RSocketStrategiesCustomizer jacksonCborRSocketStrategyCustomizer(Jackson2ObjectMapperBuilder builder) { public RSocketStrategiesCustomizer jacksonCborRSocketStrategyCustomizer(Jackson2ObjectMapperBuilder builder) {
return (strategy) -> { 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.decoder(new Jackson2CborDecoder(objectMapper, SUPPORTED_TYPES));
strategy.encoder(new Jackson2CborEncoder(objectMapper, SUPPORTED_TYPES)); strategy.encoder(new Jackson2CborEncoder(objectMapper, SUPPORTED_TYPES));
}; };

Loading…
Cancel
Save