使注解@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 2018-06-12 20:54  harrell  阅读(2407)  评论(0编辑  收藏  举报