简体   繁体   中英

How do I include two files of the same name in my spring application context?

Not sure if this has an answer, but here goes. I'm using JUnit 4.8.1 to test my Spring 3.1.0.RELEASE project. I have two JAR files on my classpath. Within each, there are files of identical names -- /module/rootContext.xml .

In my testApplicationContext.xml file (my Spring context file for my JUnit tests), is it possible to include each of those? Right now, the only thing I know how to do is

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

but I don't know how to specify the exact JAR file where each file lives.

Because I'm dealing with code that's not my own, it is not an option to change the names of the XML files within the JARs.

If you want to include both files simultaneosly, you can do it as follows:

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

See also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM