Skip to content

Commit 5beb7ed

Browse files
committed
Reinstate RSocket codecs configuration ordering
Since spring-projects/spring-framework#23314 and the following commit spring-projects/spring-framework@be4facef1b, the RSocket codec selection is relaxed and the order of configured commits matters again. This commit ensures that the CBOR codec is configured ahead of the JSON codec so that it can be chosen first if no data mime type is specified when a connection is established with a client requester.
1 parent 1996952 commit 5beb7ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.boot.rsocket.messaging.RSocketStrategiesCustomizer;
3232
import org.springframework.context.annotation.Bean;
3333
import org.springframework.context.annotation.Configuration;
34+
import org.springframework.core.annotation.Order;
3435
import org.springframework.http.MediaType;
3536
import org.springframework.http.codec.cbor.Jackson2CborDecoder;
3637
import org.springframework.http.codec.cbor.Jackson2CborEncoder;
@@ -65,6 +66,7 @@ protected static class JacksonCborStrategyConfiguration {
6566
private static final MediaType[] SUPPORTED_TYPES = { MediaType.APPLICATION_CBOR };
6667

6768
@Bean
69+
@Order(0)
6870
@ConditionalOnBean(Jackson2ObjectMapperBuilder.class)
6971
public RSocketStrategiesCustomizer jacksonCborRSocketStrategyCustomizer(Jackson2ObjectMapperBuilder builder) {
7072
return (strategy) -> {
@@ -84,6 +86,7 @@ protected static class JacksonJsonStrategyConfiguration {
8486
new MediaType("application", "*+json") };
8587

8688
@Bean
89+
@Order(1)
8790
@ConditionalOnBean(ObjectMapper.class)
8891
public RSocketStrategiesCustomizer jacksonJsonRSocketStrategyCustomizer(ObjectMapper objectMapper) {
8992
return (strategy) -> {

0 commit comments

Comments
 (0)