org.springframework.messaging.converter.CompositeMessageConverter Java Examples
The following examples show how to use
org.springframework.messaging.converter.CompositeMessageConverter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void configureMessageConvertersCustomAndDefault() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return true; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(4)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); assertThat(iterator.next(), Matchers.instanceOf(StringMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(ByteArrayMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(MappingJackson2MessageConverter.class)); }
Example #2
Source File: QueueMessagingTemplateTest.java From spring-cloud-aws with Apache License 2.0 | 6 votes |
@Test void instantiation_withConverter_shouldAddItToTheCompositeConverter() { // Arrange SimpleMessageConverter simpleMessageConverter = new SimpleMessageConverter(); // Act QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate( createAmazonSqs(), (ResourceIdResolver) null, simpleMessageConverter); // Assert assertThat( ((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter()) .getConverters()).hasSize(2); assertThat( ((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter()) .getConverters().get(1)).isEqualTo(simpleMessageConverter); }
Example #3
Source File: AbstractMessageChannelMessagingSendingTemplate.java From spring-cloud-aws with Apache License 2.0 | 6 votes |
protected void initMessageConverter(MessageConverter messageConverter) { StringMessageConverter stringMessageConverter = new StringMessageConverter(); stringMessageConverter.setSerializedPayloadClass(String.class); List<MessageConverter> messageConverters = new ArrayList<>(); messageConverters.add(stringMessageConverter); if (messageConverter != null) { messageConverters.add(messageConverter); } else { MappingJackson2MessageConverter mappingJackson2MessageConverter = new MappingJackson2MessageConverter(); mappingJackson2MessageConverter.setSerializedPayloadClass(String.class); messageConverters.add(mappingJackson2MessageConverter); } setMessageConverter(new CompositeMessageConverter(messageConverters)); }
Example #4
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void configureMessageConvertersCustom() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return false; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(1)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); }
Example #5
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void configureMessageConvertersCustom() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return false; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(1)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); }
Example #6
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void configureMessageConvertersCustomAndDefault() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return true; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(4)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); assertThat(iterator.next(), Matchers.instanceOf(StringMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(ByteArrayMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(MappingJackson2MessageConverter.class)); }
Example #7
Source File: QueueMessageHandler.java From spring-cloud-aws with Apache License 2.0 | 6 votes |
@Override protected List<? extends HandlerMethodArgumentResolver> initArgumentResolvers() { List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>( getCustomArgumentResolvers()); resolvers.add(new HeaderMethodArgumentResolver(null, null)); resolvers.add(new SqsHeadersMethodArgumentResolver()); resolvers.add(new NotificationSubjectArgumentResolver()); resolvers.add(new AcknowledgmentHandlerMethodArgumentResolver(ACKNOWLEDGMENT)); resolvers.add(new VisibilityHandlerMethodArgumentResolver(VISIBILITY)); CompositeMessageConverter compositeMessageConverter = createPayloadArgumentCompositeConverter(); resolvers.add(new NotificationMessageArgumentResolver(compositeMessageConverter)); resolvers.add(new MessageMethodArgumentResolver( this.messageConverters.isEmpty() ? new StringMessageConverter() : new CompositeMessageConverter(this.messageConverters))); resolvers.add(new PayloadArgumentResolver(compositeMessageConverter, new NoOpValidator())); return resolvers; }
Example #8
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void configureMessageConvertersCustomAndDefault() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return true; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(4)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); assertThat(iterator.next(), Matchers.instanceOf(StringMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(ByteArrayMessageConverter.class)); assertThat(iterator.next(), Matchers.instanceOf(MappingJackson2MessageConverter.class)); }
Example #9
Source File: SimpAnnotationMethodMessageHandler.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Create an instance of SimpAnnotationMethodMessageHandler with the given * message channels and broker messaging template. * @param clientInboundChannel the channel for receiving messages from clients (e.g. WebSocket clients) * @param clientOutboundChannel the channel for messages to clients (e.g. WebSocket clients) * @param brokerTemplate a messaging template to send application messages to the broker */ public SimpAnnotationMethodMessageHandler(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel, SimpMessageSendingOperations brokerTemplate) { Assert.notNull(clientInboundChannel, "clientInboundChannel must not be null"); Assert.notNull(clientOutboundChannel, "clientOutboundChannel must not be null"); Assert.notNull(brokerTemplate, "brokerTemplate must not be null"); this.clientInboundChannel = clientInboundChannel; this.clientMessagingTemplate = new SimpMessagingTemplate(clientOutboundChannel); this.brokerTemplate = brokerTemplate; Collection<MessageConverter> converters = new ArrayList<MessageConverter>(); converters.add(new StringMessageConverter()); converters.add(new ByteArrayMessageConverter()); this.messageConverter = new CompositeMessageConverter(converters); }
Example #10
Source File: SimpAnnotationMethodMessageHandler.java From java-technology-stack with MIT License | 6 votes |
/** * Create an instance of SimpAnnotationMethodMessageHandler with the given * message channels and broker messaging template. * @param clientInboundChannel the channel for receiving messages from clients (e.g. WebSocket clients) * @param clientOutboundChannel the channel for messages to clients (e.g. WebSocket clients) * @param brokerTemplate a messaging template to send application messages to the broker */ public SimpAnnotationMethodMessageHandler(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel, SimpMessageSendingOperations brokerTemplate) { Assert.notNull(clientInboundChannel, "clientInboundChannel must not be null"); Assert.notNull(clientOutboundChannel, "clientOutboundChannel must not be null"); Assert.notNull(brokerTemplate, "brokerTemplate must not be null"); this.clientInboundChannel = clientInboundChannel; this.clientMessagingTemplate = new SimpMessagingTemplate(clientOutboundChannel); this.brokerTemplate = brokerTemplate; Collection<MessageConverter> converters = new ArrayList<>(); converters.add(new StringMessageConverter()); converters.add(new ByteArrayMessageConverter()); this.messageConverter = new CompositeMessageConverter(converters); }
Example #11
Source File: RocketMQMessageConverter.java From rocketmq-spring with Apache License 2.0 | 6 votes |
public RocketMQMessageConverter() { List<MessageConverter> messageConverters = new ArrayList<>(); ByteArrayMessageConverter byteArrayMessageConverter = new ByteArrayMessageConverter(); byteArrayMessageConverter.setContentTypeResolver(null); messageConverters.add(byteArrayMessageConverter); messageConverters.add(new StringMessageConverter()); if (JACKSON_PRESENT) { messageConverters.add(new MappingJackson2MessageConverter()); } if (FASTJSON_PRESENT) { try { messageConverters.add( (MessageConverter)ClassUtils.forName( "com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter", ClassUtils.getDefaultClassLoader()).newInstance()); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) { //ignore this exception } } messageConverter = new CompositeMessageConverter(messageConverters); }
Example #12
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void configureMessageConvertersCustom() { final MessageConverter testConverter = mock(MessageConverter.class); AbstractMessageBrokerConfiguration config = new BaseTestMessageBrokerConfig() { @Override protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { messageConverters.add(testConverter); return false; } }; CompositeMessageConverter compositeConverter = config.brokerMessageConverter(); assertThat(compositeConverter.getConverters().size(), Matchers.is(1)); Iterator<MessageConverter> iterator = compositeConverter.getConverters().iterator(); assertThat(iterator.next(), Matchers.is(testConverter)); }
Example #13
Source File: KafkaStreamsBinderSupportAutoConfiguration.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 5 votes |
@Bean public KafkaStreamsMessageConversionDelegate messageConversionDelegate( @Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter, SendToDlqAndContinue sendToDlqAndContinue, KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, @Qualifier("binderConfigurationProperties") KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { return new KafkaStreamsMessageConversionDelegate(compositeMessageConverter, sendToDlqAndContinue, KafkaStreamsBindingInformationCatalogue, binderConfigurationProperties); }
Example #14
Source File: CompositeMessageConverterFactory.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
/** * Creation method. * @param mimeType the target MIME type * @return a converter for the target MIME type */ public MessageConverter getMessageConverterForType(MimeType mimeType) { List<MessageConverter> converters = new ArrayList<>(); for (MessageConverter converter : this.converters) { if (converter instanceof AbstractMessageConverter) { for (MimeType type : ((AbstractMessageConverter) converter) .getSupportedMimeTypes()) { if (type.includes(mimeType)) { converters.add(converter); } } } else { if (this.log.isDebugEnabled()) { this.log.debug("Ommitted " + converter + " of type " + converter.getClass().toString() + " for '" + mimeType.toString() + "' as it is not an AbstractMessageConverter"); } } } if (CollectionUtils.isEmpty(converters)) { throw new ConversionException( "No message converter is registered for " + mimeType.toString()); } if (converters.size() > 1) { return new CompositeMessageConverter(converters); } else { return converters.get(0); } }
Example #15
Source File: KafkaStreamsMessageConversionDelegate.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 5 votes |
KafkaStreamsMessageConversionDelegate( CompositeMessageConverter compositeMessageConverter, SendToDlqAndContinue sendToDlqAndContinue, KafkaStreamsBindingInformationCatalogue kstreamBindingInformationCatalogue, KafkaStreamsBinderConfigurationProperties kstreamBinderConfigurationProperties) { this.compositeMessageConverter = compositeMessageConverter; this.sendToDlqAndContinue = sendToDlqAndContinue; this.kstreamBindingInformationCatalogue = kstreamBindingInformationCatalogue; this.kstreamBinderConfigurationProperties = kstreamBinderConfigurationProperties; }
Example #16
Source File: MessageBrokerBeanDefinitionParserTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void messageConvertersDefaultsOff() { loadBeanDefinitions("websocket-config-broker-converters-defaults-off.xml"); CompositeMessageConverter compositeConverter = this.appContext.getBean(CompositeMessageConverter.class); assertNotNull(compositeConverter); assertEquals(1, compositeConverter.getConverters().size()); assertEquals(StringMessageConverter.class, compositeConverter.getConverters().iterator().next().getClass()); }
Example #17
Source File: MessageBrokerBeanDefinitionParserTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void messageConverters() { loadBeanDefinitions("websocket-config-broker-converters.xml"); CompositeMessageConverter compositeConverter = this.appContext.getBean(CompositeMessageConverter.class); assertNotNull(compositeConverter); assertEquals(4, compositeConverter.getConverters().size()); assertEquals(StringMessageConverter.class, compositeConverter.getConverters().iterator().next().getClass()); }
Example #18
Source File: MessageConverterDelegateSerde.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 5 votes |
public MessageConverterDelegateSerde( CompositeMessageConverter compositeMessageConverter) { this.messageConverterDelegateDeserializer = new MessageConverterDelegateDeserializer<>( compositeMessageConverter); this.messageConverterDelegateSerializer = new MessageConverterDelegateSerializer<>( compositeMessageConverter); }
Example #19
Source File: SimpleFunctionRegistryTests.java From spring-cloud-function with Apache License 2.0 | 5 votes |
@BeforeEach public void before() { List<MessageConverter> messageConverters = new ArrayList<>(); JsonMapper jsonMapper = new GsonMapper(new Gson()); messageConverters.add(NegotiatingMessageConverterWrapper.wrap(new JsonMessageConverter(jsonMapper))); messageConverters.add(NegotiatingMessageConverterWrapper.wrap(new ByteArrayMessageConverter())); messageConverters.add(NegotiatingMessageConverterWrapper.wrap(new StringMessageConverter())); this.messageConverter = new CompositeMessageConverter(messageConverters); this.conversionService = new DefaultConversionService(); }
Example #20
Source File: MessageBrokerBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
private RuntimeBeanReference registerMessageConverter(Element element, ParserContext context, Object source) { Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters"); ManagedList<? super Object> converters = new ManagedList<Object>(); if (convertersElement != null) { converters.setSource(source); for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) { Object object = context.getDelegate().parsePropertySubElement(beanElement, null); converters.add(object); } } if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) { converters.setSource(source); converters.add(new RootBeanDefinition(StringMessageConverter.class)); converters.add(new RootBeanDefinition(ByteArrayMessageConverter.class)); if (jackson2Present) { RootBeanDefinition jacksonConverterDef = new RootBeanDefinition(MappingJackson2MessageConverter.class); RootBeanDefinition resolverDef = new RootBeanDefinition(DefaultContentTypeResolver.class); resolverDef.getPropertyValues().add("defaultMimeType", MimeTypeUtils.APPLICATION_JSON); jacksonConverterDef.getPropertyValues().add("contentTypeResolver", resolverDef); // Use Jackson factory in order to have JSR-310 and Joda-Time modules registered automatically GenericBeanDefinition jacksonFactoryDef = new GenericBeanDefinition(); jacksonFactoryDef.setBeanClass(Jackson2ObjectMapperFactoryBean.class); jacksonFactoryDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); jacksonFactoryDef.setSource(source); jacksonConverterDef.getPropertyValues().add("objectMapper", jacksonFactoryDef); converters.add(jacksonConverterDef); } } ConstructorArgumentValues cavs = new ConstructorArgumentValues(); cavs.addIndexedArgumentValue(0, converters); RootBeanDefinition messageConverterDef = new RootBeanDefinition(CompositeMessageConverter.class, cavs, null); return new RuntimeBeanReference(registerBeanDef(messageConverterDef, context, source)); }
Example #21
Source File: MessageConverterConfigurer.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
public MessageConverterConfigurer(BindingServiceProperties bindingServiceProperties, CompositeMessageConverter compositeMessageConverter, StreamFunctionProperties streamFunctionProperties) { Assert.notNull(compositeMessageConverter, "The message converter factory cannot be null"); this.bindingServiceProperties = bindingServiceProperties; this.compositeMessageConverter = compositeMessageConverter; this.headersField = ReflectionUtils.findField(MessageHeaders.class, "headers"); this.headersField.setAccessible(true); this.streamFunctionProperties = streamFunctionProperties; }
Example #22
Source File: BinderFactoryAutoConfiguration.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean public MessageConverterConfigurer messageConverterConfigurer( BindingServiceProperties bindingServiceProperties, @Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter, @Nullable StreamFunctionProperties streamFunctionProperties) { return new MessageConverterConfigurer(bindingServiceProperties, compositeMessageConverter, streamFunctionProperties); }
Example #23
Source File: BinderFactoryAutoConfiguration.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean public MessageSourceBindingTargetFactory messageSourceFactory( @Qualifier(IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) CompositeMessageConverter compositeMessageConverter, CompositeMessageChannelConfigurer compositeMessageChannelConfigurer) { return new MessageSourceBindingTargetFactory(compositeMessageConverter, compositeMessageChannelConfigurer); }
Example #24
Source File: ContentTypeConfiguration.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean(name = IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME) public CompositeMessageConverter configurableCompositeMessageConverter( ObjectProvider<ObjectMapper> objectMapperObjectProvider, List<MessageConverter> customMessageConverters) { customMessageConverters = customMessageConverters.stream() .filter(c -> isConverterEligible(c)).collect(Collectors.toList()); CompositeMessageConverterFactory factory = new CompositeMessageConverterFactory(customMessageConverters, objectMapperObjectProvider.getIfAvailable(ObjectMapper::new)); return factory.getMessageConverterForAllRegistered(); }
Example #25
Source File: QueueMessageHandler.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
private CompositeMessageConverter createPayloadArgumentCompositeConverter() { List<MessageConverter> payloadArgumentConverters = new ArrayList<>( this.messageConverters); ObjectMessageConverter objectMessageConverter = new ObjectMessageConverter(); objectMessageConverter.setStrictContentTypeMatch(true); payloadArgumentConverters.add(objectMessageConverter); payloadArgumentConverters.add(new SimpleMessageConverter()); return new CompositeMessageConverter(payloadArgumentConverters); }
Example #26
Source File: QueueMessagingTemplateTest.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Test void instantiation_withoutConverter_shouldAddDefaultJacksonConverterToTheCompositeConverter() { // Act QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate( createAmazonSqs(), (ResourceIdResolver) null, null); // Assert assertThat( ((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter()) .getConverters()).hasSize(2); assertThat( ((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter()) .getConverters().get(1)) .isInstanceOf(MappingJackson2MessageConverter.class); }
Example #27
Source File: MessageSendingTemplateTests.java From java-technology-stack with MIT License | 5 votes |
@Test(expected = MessageConversionException.class) public void convertAndSendNoMatchingConverter() { MessageConverter converter = new CompositeMessageConverter( Arrays.<MessageConverter>asList(new MappingJackson2MessageConverter())); this.template.setMessageConverter(converter); this.headers.put(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_XML); this.template.convertAndSend("home", "payload", new MessageHeaders(this.headers)); }
Example #28
Source File: RqueueMessageSenderImpl.java From rqueue with Apache License 2.0 | 5 votes |
private RqueueMessageSenderImpl( RqueueMessageTemplate messageTemplate, List<MessageConverter> messageConverters, boolean addDefault) { notNull(messageTemplate, "messageTemplate cannot be null"); notEmpty(messageConverters, "messageConverters cannot be empty"); this.messageTemplate = messageTemplate; this.messageConverter = new CompositeMessageConverter(getMessageConverters(addDefault, messageConverters)); }
Example #29
Source File: SimpAnnotationMethodMessageHandler.java From spring-analysis-note with MIT License | 5 votes |
/** * Create an instance of SimpAnnotationMethodMessageHandler with the given * message channels and broker messaging template. * @param clientInboundChannel the channel for receiving messages from clients (e.g. WebSocket clients) * @param clientOutboundChannel the channel for messages to clients (e.g. WebSocket clients) * @param brokerTemplate a messaging template to send application messages to the broker */ public SimpAnnotationMethodMessageHandler(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel, SimpMessageSendingOperations brokerTemplate) { Assert.notNull(clientInboundChannel, "clientInboundChannel must not be null"); Assert.notNull(clientOutboundChannel, "clientOutboundChannel must not be null"); Assert.notNull(brokerTemplate, "brokerTemplate must not be null"); this.clientInboundChannel = clientInboundChannel; this.clientMessagingTemplate = new SimpMessagingTemplate(clientOutboundChannel); this.brokerTemplate = brokerTemplate; Collection<MessageConverter> converters = new ArrayList<>(); converters.add(new StringMessageConverter()); converters.add(new ByteArrayMessageConverter()); this.messageConverter = new CompositeMessageConverter(converters); }
Example #30
Source File: AbstractMessageBrokerConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@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()); } } return new CompositeMessageConverter(converters); }