Results 1 to 4 of 4

Thread: multiple configuration files causes problem in property-placeholder

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Location
    Tehran
    Posts
    48

    Unhappy multiple configuration files causes problem in property-placeholder

    I have 2 bean configuration files: a-ctx.xml , b-ctx.xml
    In each of them I have one context: property-placeholder refers to a.properties and b.properties.

    When I both of load bean configuration files (in different ways. loading an array of them, in test case annotation, ...) the properties file in second loaded file is not loaded.

    Is this a bug?

  2. #2
    Join Date
    Dec 2010
    Location
    Tehran
    Posts
    48

    Default

    By more tests I see this problem essentially is related to Spring behavior with 2 property-placeholder in a context. Spring ignores the second.

    But What is solution? I have a configuration file and its referred .properties file (a-ctx.xml and a.properties) as part of main program.
    Second configuration file is owned by test class (b-ctx.xml).
    I can't change main program configuration for test and test class need some properties too.

    What is solution now?

  3. #3
    Join Date
    Mar 2010
    Location
    Croatia
    Posts
    8

    Default

    When PropertyPlaceholderConfigurer completes resolving the placeholders, it throws an exception if there are any unresolved placeholders left.

    You can avoid that behavior by setting ignore-unresolvable attribute of property-placeholder tag to true.

  4. #4
    Join Date
    Dec 2009
    Location
    Pune,India
    Posts
    60

    Default

    Hi I wrote test programme I do not have any problem can you please post you junit test code and xml files.

Tags for this Thread

Posting Permissions

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