【发布时间】:2013-05-30 21:09:32
【问题描述】:
只有在满足特定条件的情况下,我才能在 spring 上下文中导入东西吗?
<!-- import ONLY IF current environment is NOT testing -->
<import resource="classpath:context/caching-context.xml" />
目前我通过在我的测试用例中导入完全不同的上下文来做到这一点
@ContextConfiguration(locations = { "classpath*:ApplicationContextTesting.xml" })
但也许有一个更优雅的解决方案,不为生产和测试维护两个单独的应用程序上下文。
【问题讨论】: