随笔 - 39  文章 - 0  评论 - 56  阅读 - 12万

使注解@ContextConfiguration同时支持locations和classes

@Configuration
@ImportResource("classpath:META-INF/dataContext.xml")
class TestConfig {
}

And, in your test code use the following:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {Configuration.class, TestConfig.class})
@ActiveProfiles("test")
public class CityDaoImplTest { ... }

 

posted on   harrell  阅读(2420)  评论(0)    收藏  举报
编辑推荐:
· 日常问题排查-空闲一段时间再请求就超时
· Java虚拟机代码是如何一步一步变复杂且难以理解的?
· 领域驱动的事实与谬误 一 DDD 与 MVC
· SQL Server 2025 中的改进
· 当数据爆炸遇上SQL Server:优化策略全链路解析
阅读排行:
· 日常问题排查-空闲一段时间再请求就超时
· C# 14 新增功能一览,你觉得实用吗?
· 揭秘 AI 工具的系统提示词「GitHub 热点速览」
· MySQL同步ES的6种方案!
· 解密AI知识库
< 2025年5月 >
27 28 29 30 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
1 2 3 4 5 6 7

点击右上角即可分享
微信分享提示