Announcement Announcement Module
Collapse
No announcement yet.
wildcard matching and contexts in external jars Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 (http://www.nabble.com/-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 = { "classpath:applicationContext*.xml"};
    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 = { "applicationContext.xml", "applicationContext-hibernate.xml" };
    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

  • #2
    Try using classpath*:applicationContext*.xml - this way all classpaths will be searched for the matching files.

    Comment


    • #3
      Thanks Costin, that did the trick!

      Comment


      • #4
        Hi

        See also:

        http://static.springframework.org/sp...s.html#d0e5951

        Cheers
        Rick

        Comment

        Working...
        X