@SpringBootApplicationpublic class So42803627Application { public static void main(String[] args) { SpringApplication.run(So42803627Application.class, args); } @Autowired private JmsTemplate jmsTemplate; @JmsListener(destination = "foo") public void handle(String in) { this.jmsTemplate.convertAndSend("bar", in.toUpperCase()); }}
和
@RunWith(SpringRunner.class)@SpringBootTestpublic class So42803627ApplicationTests { @Autowired private JmsTemplate jmsTemplate; @Test public void test() { this.jmsTemplate.convertAndSend("foo", "Hello, world!"); this.jmsTemplate.setReceiveTimeout(10_000); assertThat(this.jmsTemplate.receiveAndConvert("bar")).isEqualTo("HELLO, WORLD!"); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)