title: How to make Spring JMS pick destination queue name from annotation @JmsListener
body: <p>Any help will be greatly appreciated. I am trying to create a replacement for MDB with spring JMSListener.  I wanted the destination name to be passed as a annotation, but i noticed that  <code>org.springframework.jms.listener.DefaultMessageListenerContainer</code> container config has <code>destinationName</code> or <code>destination</code> as mandatory. Am i missing something ? How to make use of destination resolver to use queue name from <code>@JmsListener</code> annotation?</p>
  
  <pre><code>@Component 
  public class InitStRspnLstnr {
  
  @JmsListener(destination = "${xyz.company.MQ.INITST.RSPN.FADS.Q}")
  public void onMessage(Message msg) throws JMSException {
      System.out.println("**********************************************"+msg);
  }}
  </code></pre>
  
  <p>Below is my Xml pasted, I commented the container for now, since spring was trying to connect to dummy queue instead of the one in annotation..</p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:util="http://www.springframework.org/schema/util"
          xmlns:mvc="http://www.springframework.org/schema/mvc"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:cxf="http://cxf.apache.org/core"    
          xmlns:jaxrs="http://cxf.apache.org/jaxrs"
          xmlns:jaxws="http://cxf.apache.org/jaxws"    
          xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/mvc
              http://www.springframework.org/schema/mvc/spring-mvc.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context.xsd  
              http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
              http://cxf.apache.org/jaxrs
              http://cxf.apache.org/schemas/jaxrs.xsd
              http://cxf.apache.org/jaxws
              http://cxf.apache.org/schemas/jaxws.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
              "&gt;
  
          &lt;import resource="classpath*:com/xyz/svc/component.xml"/&gt;
  
          &lt;mvc:annotation-driven enable-matrix-variables="true"/&gt;
          &lt;context:component-scan base-package="com.xyz.css.rplr.initst"&gt;&lt;/context:component-scan&gt;
  
          &lt;!-- WebSphere MQ Connection setup start --&gt;
          &lt;bean id="mqIdsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"&gt;
              &lt;property name="hostName"&gt;&lt;value&gt;${xyz.company.MQ.HOST.NM}&lt;/value&gt;&lt;/property&gt;
              &lt;property name="port"&gt;&lt;value&gt;${xyz.company.MQ.PORT}&lt;/value&gt;&lt;/property&gt;
              &lt;property name="queueManager"&gt;&lt;value&gt;${xyz.company.MQ.QMNGR}&lt;/value&gt;&lt;/property&gt;
              &lt;property name="channel"&gt;&lt;value&gt;${xyz.company.MQ.CHANNEL}&lt;/value&gt;&lt;/property&gt;
              &lt;property name="CCSID"&gt;&lt;value&gt;819&lt;/value&gt;&lt;/property&gt;
              &lt;property name="transportType"&gt;
                  &lt;util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" /&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
          &lt;bean id="jmsQueueIdsConnectionFactory"
              class="org.springframework.jms.connection.SingleConnectionFactory"&gt;
              &lt;property name="targetConnectionFactory"&gt;
                  &lt;ref bean="mqIdsConnectionFactory" /&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
          &lt;bean id="jmsDestinationResolver"
              class="org.springframework.jms.support.destination.DynamicDestinationResolver"&gt;
          &lt;/bean&gt;
          &lt;bean id="jmsQueueIdsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
              &lt;property name="connectionFactory"&gt;
                  &lt;ref bean="jmsQueueIdsConnectionFactory" /&gt;
              &lt;/property&gt;
              &lt;property name="destinationResolver"&gt;
                  &lt;ref bean="jmsDestinationResolver" /&gt;
              &lt;/property&gt; &lt;!--    
              &lt;property name="defaultDestinationName"&gt;
                  &lt;value&gt;${xyz.company.MQ.INITST.Q}&lt;/value&gt;
              &lt;/property&gt;--&gt;
              &lt;property name="pubSubDomain"&gt;
                  &lt;value&gt;false&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="receiveTimeout"&gt;
                  &lt;value&gt;20000&lt;/value&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;!-- &lt;bean id="jmsContainer"
              class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt;
              &lt;property name="connectionFactory"&gt;
                  &lt;ref bean="jmsQueueIdsConnectionFactory" /&gt;
              &lt;/property&gt;
              &lt;property name="destinationResolver"&gt;
                  &lt;ref bean="jmsDestinationResolver" /&gt;
              &lt;/property&gt;
              &lt;property name="destinationName" value="dummyQueue"/&gt;
              &lt;property name="concurrency" value="3-10" /&gt;
          &lt;/bean&gt; --&gt;
  
          &lt;!-- WebSphere MQ Connection setup end --&gt;
      &lt;/beans&gt;
  </code></pre>