title: Failed to start bean 'org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry'
body: <p>I have a simple spring-boot application with a rabbit sender and a receiver. I want to write some receiver tests where I am running a <strong>rabbitmq docker</strong> instance as Junit Class Rule (<a href="https://geowarin.github.io/docker-junit-rule.html" rel="nofollow noreferrer">RabbitContainerRule</a>)and then sending a message using rabbitTemplate and the test verifies if the receiver receives the same message. But I am getting the following exception:</p>
  
  <pre><code>Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
  at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
  
  Caused by: org.springframework.amqp.rabbit.listener.QueuesNotAvailableException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.
      at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:599)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)
  
  Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method&lt;channel.close&gt;(reply-code=404, reply-text=NOT_FOUND - no queue 'my-message-queue' in vhost '/', class-id=50, method-id=10)
      at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
  </code></pre>
  
  <p><em>If I create the queue manually(by stopping at a breakpoint) in the docker instance using admin console,  my test passes.</em> </p>
  
  <p>Also, if I test it manually using the docker rabbit instance, my spring boot application creates queue successfully. So what is causing it to not create in the test? </p>
  
  <p>I am using <strong>spring-amqp 1.7.4 RELEASE</strong></p>
  
  <p>Receiver code:</p>
  
  <pre><code>@RabbitListener(bindings = @QueueBinding(
          value = @Queue(value = "my-message-queue", durable = "true",
                  arguments = {
                          @Argument(name = "x-dead-letter-exchange", value = "my-message-exchange-dead-letter"),
                          @Argument(name = "x-dead-letter-routing-key", value = "my-message-queue")}),
          exchange = @Exchange(value = "my-message-exchange", type = "topic", durable = "true"),
          key = "my-message-rk")
  )
  public void handleMessage(MyMessage message) {
      MESSAGE_LOG.info("Receiving message: " + message);
  }
  </code></pre>
  
  <p>Also I am not creating any @Bean for <em>my-message-queue</em> in Configurations and rely on <strong>@RabbitListener</strong> to create one for me. But I am creating ConnectionFactory, RabbitTemplate and SimpleRabbitListenerContainerFactory beans in my config.</p>