如何将@queuebinding 与@rabbitlistener 一起使用?

how to use @queuebinding with @rabbitlistener?

好像是从spring-amqp version 1.5开始,有一个新的注解@queuebinding。但是怎么用,不知道能不能用在class或者a上方法?有例子吗?

不确定您遇到了什么问题,但这里有一个示例完全来自 Reference Manual:

@Component
public class MyService {

  @RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "myQueue", durable = "true"),
        exchange = @Exchange(value = "auto.exch"),
        key = "orderRoutingKey")
  )
  public void processOrder(String data) {
    ...
  }

是的,它可以在 class 级别和方法级别上使用。