use of org.springframework.messaging.converter.ByteArrayMessageConverter in project spring-integration by spring-projects.
the class ConfigurableCompositeMessageConverter method initDefaults.
private static Collection<MessageConverter> initDefaults() {
List<MessageConverter> converters = new LinkedList<>();
if (JacksonPresent.isJackson2Present()) {
converters.add(new MappingJackson2MessageConverter());
}
converters.add(new ByteArrayMessageConverter());
converters.add(new ObjectStringMessageConverter());
// TODO do we port it together with MessageConverterUtils ?
// converters.add(new JavaSerializationMessageConverter());
converters.add(new GenericMessageConverter());
return converters;
}
use of org.springframework.messaging.converter.ByteArrayMessageConverter in project spring-cloud-stream by spring-cloud.
the class CompositeMessageConverterFactory method initDefaultConverters.
@SuppressWarnings("deprecation")
private void initDefaultConverters() {
ApplicationJsonMessageMarshallingConverter applicationJsonConverter = new ApplicationJsonMessageMarshallingConverter(this.objectMapper);
applicationJsonConverter.setStrictContentTypeMatch(true);
this.converters.add(applicationJsonConverter);
this.converters.add(new TupleJsonMessageConverter(this.objectMapper));
this.converters.add(new ByteArrayMessageConverter());
this.converters.add(new ObjectStringMessageConverter());
// Deprecated converters
this.converters.add(new JavaSerializationMessageConverter());
this.converters.add(new KryoMessageConverter(null, true));
this.converters.add(new JsonUnmarshallingConverter(this.objectMapper));
}
use of org.springframework.messaging.converter.ByteArrayMessageConverter in project spring-framework by spring-projects.
the class AbstractMessageBrokerConfiguration method brokerMessageConverter.
@Bean
public CompositeMessageConverter brokerMessageConverter() {
List<MessageConverter> converters = new ArrayList<>();
boolean registerDefaults = configureMessageConverters(converters);
if (registerDefaults) {
converters.add(new StringMessageConverter());
converters.add(new ByteArrayMessageConverter());
if (jackson2Present) {
converters.add(createJacksonConverter());
} else if (gsonPresent) {
converters.add(new GsonMessageConverter());
} else if (jsonbPresent) {
converters.add(new JsonbMessageConverter());
} else if (kotlinSerializationJsonPresent) {
converters.add(new KotlinSerializationJsonMessageConverter());
}
}
return new CompositeMessageConverter(converters);
}
use of org.springframework.messaging.converter.ByteArrayMessageConverter in project spring-framework by spring-projects.
the class DefaultMessageHandlerMethodFactoryTests method customMessageConverterFailure.
@Test
public void customMessageConverterFailure() throws Exception {
DefaultMessageHandlerMethodFactory instance = createInstance();
MessageConverter messageConverter = new ByteArrayMessageConverter();
instance.setMessageConverter(messageConverter);
instance.afterPropertiesSet();
InvocableHandlerMethod invocableHandlerMethod = createInvocableHandlerMethod(instance, "simpleString", String.class);
assertThatExceptionOfType(MessageConversionException.class).isThrownBy(() -> invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build()));
}
use of org.springframework.messaging.converter.ByteArrayMessageConverter in project spring-framework by spring-projects.
the class DefaultStompSessionTests method setUp.
@BeforeEach
public void setUp() {
this.connectHeaders = new StompHeaders();
this.session = new DefaultStompSession(this.sessionHandler, this.connectHeaders);
this.session.setMessageConverter(new CompositeMessageConverter(Arrays.asList(new StringMessageConverter(), new ByteArrayMessageConverter())));
SettableListenableFuture<Void> future = new SettableListenableFuture<>();
future.set(null);
given(this.connection.send(this.messageCaptor.capture())).willReturn(future);
}
Aggregations