Results 1 to 4 of 4

Thread: wildcard matching and contexts in external jars

  1. #1

    Default 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. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Try using classpath*:applicationContext*.xml - this way all classpaths will be searched for the matching files.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3

    Default

    Thanks Costin, that did the trick!

  4. #4
    Join Date
    Oct 2004
    Location
    Fareham, England
    Posts
    313

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •