title: Using passed in Value for @JmsListener's destination paramter
body: <p>Is there a specific way to accomplish this? I tried to find a solution on here but couldn't find what I need. I have a Spring Boot application that will be accepting multiple arguments from the command line. The argument in question is the queue name (i.e. the destination). It can be one of several of our many queues. The <code>JmsListener</code> is in the form</p>
  
  <pre><code>@JmsListener(destination="dest_goes_here")
  public void processOrder(Message message){. . .}
  </code></pre>
  
  <p>I have a class that basically looks like this</p>
  
  <pre><code> public class Arguments {
   private static queue
   private static antoherArg
   :
   :
  getters and setters
   }
  </code></pre>
  
  <p>And what I would like to say is <code>destination = Arguments.getQueue()</code>, but it seems <code>destination</code> can only be a <code>static final</code> variable? I assume this because the error presents a little tooltip that alludes to that. </p>
  
  <p>I also tested it, as I have yet another class called <code>Constants</code>, that obvioulsy contains constants, and if I hard code the queue name as <code>public static final String QUEUE = "MyQ";</code> then say <code>destination = Constants.QUEUE</code> it is ok with that. </p>
  
  <p>So then I assumed I could do something like this in my listener class <code>private static final String QUEUE = Arguments.getQueue();</code> But it doesn't like that either. Alas, I am stumped.</p>
  
  <p>So really two questions here if anyone is willing to knowledge share. Why is the <code>@JmsListener</code> ok with having <code>destination</code> set to my second solution, but not the first and the last?</p>
  
  <p>And then the main question (that I'd prefer you answer over the first) is, what strategies can I make use of to set destination to a variable that originates from the command line (i.e. be dynamic)?</p>
  
  <p>Edit: To clarify, I cannot keep the value in my <code>Constants</code> class, as the value will be coming from the command line and needs to be passed to the JmsListener class to be used as the <code>destination</code>.</p>