【问题标题】:@JmsListener not calling from Integration Test@JmsListener 没有从集成测试中调用
【发布时间】:2019-01-02 16:22:14
【问题描述】:

我已将 ActiveMQ 与我的 Spring-Boot 应用程序集成,它运行良好。但是当我尝试使用 Embedded ActiveMQ 为我的 @JmsListener 创建集成测试时,它只是在寻找外部 ActiveMQ 而不是内部。

所以我的案子总是失败。无论如何用 application-test.yml 覆盖默认的 application.yml 所以我的接收器调用有@JmsListner 寻找嵌入式代理 url 而不是外部的(我在 application.yml 中声明)

【问题讨论】:

  • 一些代码示例可能会有所帮助

标签: spring-boot activemq integration-testing spring-jms


【解决方案1】:

要覆盖,请使用@TestPropertySource

例子:

@TestPropertySource(locations = "classpath:application-test.yml")
public class IntegrationClass {

你的 application-test.yml 应该放在 src/test/resources/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 2019-09-16
    • 1970-01-01
    • 2010-11-01
    • 2014-03-13
    • 2016-07-18
    相关资源
    最近更新 更多