title: How does Spring Boot know whether MessageMapping specifies a Jms Queue or a Websocket topic?
body: <p>I have a Controller bean with a method such as</p>
  
  <pre><code>@MessageMapping("${my.topic}")
  public void receiveCommand(Message content) {
      log.info("Received command: " + content);
  }
  </code></pre>
  
  <p>And I also inject a <code>SimpMessagingTemplate</code> and a <code>JmsMessagingTemplate</code> into this controller. I believe the problem with my <code>receiveCommand</code> method is that Spring is expecting this to be a JMS message and not a WebSocket message. However this seems impossible to determine, how can I make sure that this method corresponds to a WebSocket topic and not a JMS queue?</p>
  
  <p>My application is annotated with <code>@EnableJms</code> and <code>@EnableWebSocket</code> and works well for receiving JMS messages and sending WebSocket messages via STOMP, but doesn't seem to be able to receive WebSocket messages.</p>
  
  <p>The message imports are as follows on my Controller.</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.jms.annotation.JmsListener;
  import org.springframework.jms.core.JmsTemplate;
  import org.springframework.messaging.Message;
  import org.springframework.messaging.handler.annotation.MessageMapping;
  import org.springframework.messaging.simp.SimpMessagingTemplate;
  import org.springframework.stereotype.Component;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.stereotype.Controller;
  </code></pre>
  
  <p>I also have another method that uses a JmsListener that works, so I am wondering if this is somehow picked up by Spring on the classpath and overrides the MessageMapping to be a JMS queue name.</p>
  
  <pre><code>@JmsListener(destination = "${my.destination}")
  public void receiveMessage(String content) {
     System.out.println("Jms message: " + content); 
  }
  </code></pre>
  
  <p>I do not see any stack traces or errors when running a unit test that looks like the following.</p>
  
  <pre><code>@Autowired
  private SimpMessagingTemplate websocket;
  
  @Value("${my.topic}")
  private String topic;
  
  @Test
  public void shouldReceiveCommandMessages() throws IOException {
      URL url = Resources.getResource("command.json");
      String json = Resources.toString(url, Charsets.UTF_8);
      this.websocket.convertAndSend(topic, json);
  }
  </code></pre>
  
  <p>Which is within a larger <code>SpringBootTest</code> that works for testing the Jms sending and receiving.</p>