|
|
wildcard matching and contexts in external jars
Hi,
I've found a problem with loading Spring context files from external jars. Originally, it was a Maven mailing list discussion (-M2--Differenc....html#a5362647) but I've found that this problem refers rather to Spring than to Maven 2.
And here is the problem:
I have a jar (let's say CORE.jar) with applicationContext.xml, applicationContext-hibernate.xml, and all implementation classes inside. Then I want to use these resources in another project, which has CORE.jar on its classpath:Code:
String[] contextPaths = { quot;classpath:applicationContext*.xmlquot;};
ApplicationContext context = new ClassPathXmlApplicationContext(contextPaths);
Unfortunately neither applicationContext.xml nor applicationContext-hibernate.xml is being loaded. However, If I change my code to this:Code:
String[] contextPaths = { quot;applicationContext.xmlquot;, quot;applicationContext-hibernate.xmlquot; };
ApplicationContext context = new ClassPathXmlApplicationContext(contextPaths);
everything works fine.
So is it a bug or a feature?
Any thoughts?
I'm using JDK 1.5 and Spring Framework 2.0-RC2.
Regards,
Jakub Pawlowicz
Try using classpath*:applicationContext*.xml - this way all classpaths will be searched for the matching files.
Thanks Costin, that did the trick!
Hi
See also:
sp...s.html#d0e5951
Cheers
Rick |
|