【发布时间】:2019-11-29 18:13:30
【问题描述】:
我正在使用 JMS MOM 编写 SpringBoot 应用程序。我的应用程序支持两种 JMS:EMS 和 AMQ
我的应用程序有许多 Junit 测试。当然,无论我使用EMS还是AMQ,测试都是完全一样的,预期的结果也完全一样。唯一的区别是使用的配置文件。
@RunWith(SpringRunner.class)
@TestPropertySource(locations="classpath:application.yaml")
@ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class)
public class MyTest {
@SpringBootApplication
@ComponentScan("com.mytest")
static class Application {
}
@Test
public void test() {
...
}
}
我希望能够运行我的测试两次,一次使用 EMS 配置,另一次使用 AMQ 配置:我应该怎么做?
仅供参考,我正在使用 Maven 构建我的应用程序。基于 maven 技巧的解决方案对我来说是完全可以接受的
感谢您的帮助
【问题讨论】:
标签: spring maven spring-boot spring-boot-test