我是在整合mq遇到这个问题的,困扰了我一天。查了很多资料。一度怀疑是我代码的问题。简单明了如果你报了以下异常。并且还无限循环抛出这个异常。。。
org.springframework.amqp.AmqpException: No method found for class [B
SimpleMessageConverter only supports String, byte[] and Serializable payload
又反复找不到问题那可以试试这个方法
在MQconfig里面添加如下配置(手动新增下转换)
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setMessageConverter(new Jackson2JsonMessageConverter());
return template;
}
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setMessageConverter(new Jackson2JsonMessageConverter());
return factory;