【发布时间】:2014-05-26 13:26:42
【问题描述】:
我在做什么?
我有一个应用程序,我想在不同的环境中进行测试 - 开发、登台等
我该怎么做?
我正在使用maven cargo 插件部署应用程序战争以运行集成测试。
我需要什么?
我需要根据货物设置的环境变量来推断spring.profiles.active,例如
<container>
<containerId>tomcat7x</containerId>
<systemProperties>
<spring.profiles.active>development</spring.profiles.active>
</systemProperties>
</container>
为什么?
这样我就可以删除集成测试@ActiveProfiles("development") 中的硬编码,并且测试可以从环境变量中推断出活动配置文件是什么
问题
- 我找到了Spring integration tests with profile,其中提到了使用ActiveProfilesResolver
- 我试图找到如何使用它,但找不到任何资源
我正在寻找有关如何使用ActiveProfilesResolver的指导/建议
【问题讨论】: