您有几个选项:
进口
包含在ApplicationContext构造中
将这两个文件作为您的ApplicationContext的一部分,当您创建它=>那么不需要导入。
例如,如果您在测试期间需要它:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:META-INF/conf/spring/this-xml-conf.xml",
"classpath:META-INF/conf/spring/that-other-xml-conf.xml" })
public class CleverMoneyMakingBusinessServiceIntegrationTest {...}
如果它是一个Web应用程序,您可以在web.xml中执行:
contextConfigLocation
WEB-INF/conf/spring/this-xml-conf.xml
WEB-INF/conf/spring/that-other-xml-conf.xml
org.springframework.web.context.ContextLoaderListener
如果它是一个独立的应用程序,库等。您将加载您的ApplicationContext为:
new ClassPathXmlApplicationContext(
new String[] { "classpath:META-INF/conf/spring/this-xml-conf.xml",
"classpath:META-INF/conf/spring/that-other-xml-conf.xml" } );