小编典典
您有两种选择:
进口
包括在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.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" } );
2020-09-28