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.
This commit is contained in:
parent
1996952e68
commit
5beb7edfbb
|
|
@ -31,6 +31,7 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
|||
import org.springframework.boot.rsocket.messaging.RSocketStrategiesCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.cbor.Jackson2CborDecoder;
|
||||
import org.springframework.http.codec.cbor.Jackson2CborEncoder;
|
||||
|
|
@ -65,6 +66,7 @@ public class RSocketStrategiesAutoConfiguration {
|
|||
private static final MediaType[] SUPPORTED_TYPES = { MediaType.APPLICATION_CBOR };
|
||||
|
||||
@Bean
|
||||
@Order(0)
|
||||
@ConditionalOnBean(Jackson2ObjectMapperBuilder.class)
|
||||
public RSocketStrategiesCustomizer jacksonCborRSocketStrategyCustomizer(Jackson2ObjectMapperBuilder builder) {
|
||||
return (strategy) -> {
|
||||
|
|
@ -84,6 +86,7 @@ public class RSocketStrategiesAutoConfiguration {
|
|||
new MediaType("application", "*+json") };
|
||||
|
||||
@Bean
|
||||
@Order(1)
|
||||
@ConditionalOnBean(ObjectMapper.class)
|
||||
public RSocketStrategiesCustomizer jacksonJsonRSocketStrategyCustomizer(ObjectMapper objectMapper) {
|
||||
return (strategy) -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue