Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 431
Dave Avatar asked Sep 02 '25 10:09

Dave


1 Answers

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

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

See also:

  • 4.7.2.2 The classpath*: prefix
like image 162
axtavt Avatar answered Sep 05 '25 01:09

axtavt