【问题标题】:How do I include two files of the same name in my spring application context?如何在我的 spring 应用程序上下文中包含两个同名文件?
【发布时间】:2012-08-01 20:19:18
【问题描述】:

不确定这是否有答案,但这里有。我正在使用 JUnit 4.8.1 来测试我的 Spring 3.1.0.RELEASE 项目。我的类路径上有两个 JAR 文件。在每个文件中,都有同名的文件—— /module/rootContext.xml 。

在我的 testApplicationContext.xml 文件(我的 JUnit 测试的 Spring 上下文文件)中,是否可以包含其中的每一个?现在,我唯一知道该怎么做的是

<import resource="classpath:/module/rootContext.xml" />

但我不知道如何指定每个文件所在的确切 JAR 文件。

因为我正在处理不是我自己的代码,所以不能选择更改 JAR 中 XML 文件的名称。

【问题讨论】:

    标签: spring junit applicationcontext


    【解决方案1】:

    如果你想同时包含两个文件,你可以这样做:

    <import resource="classpath*:/module/rootContext.xml" />
    

    另请参阅:

    【讨论】:

      猜你喜欢
      • 2015-12-10
      • 1970-01-01
      • 2017-11-07
      • 1970-01-01
      • 2021-10-10
      • 2016-03-25
      • 1970-01-01
      • 2015-04-14
      • 2013-02-25
      相关资源
      最近更新 更多