1.场景还原
在实际项目中,xml配置文件有可能有多个,如何在项目启动的时候一次性的将多个文件成功的加载进去呢?这也是笔者今天要跟老铁们分享的issue
2.解决方案
①项目启动时加载配置
在web.xml中配置如下
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml,classpath:spring-rabbitmq.xml</param-value> </context-param>
②在测试用例类中配置如下
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(