Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Issue with Spring profiles and my properties files

  1. #21
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Strange.. My test is working as expected with the exact same setup only difference is I run it from a testcase and not a web application. But in theory the behavior should be the same.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  2. #22
    Join Date
    Nov 2007
    Posts
    177

    Default

    Hi Marten!

    I actually decided to give up (temporarily) on this issue and tried to switch back to a config without profiles.

    Then I realized that the issue was elsewhere. For some reason, Spring does not like this:
    Code:
    <context:property-placeholder location="classpath*:META-INF/spring/*.properties" />
    <context:property-placeholder location="classpath*:META-INF/spring/default/*.properties" />
    Notice the nested "default" directory.

    I had forgotten to mention the presence of the first line (above) in my original post because I deemed it irrelevant (sorry about that)...

  3. #23
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    The problem with that is that by default a property-placeholder resolves ALL placeholders if one cannot be found it throws an exception. You have 2 solutions for this.

    1. set the property ignore-unresolvable to true on at least the first placeholder (however order is basically undetermined so you might need to set them on both)

    2. Use a single property-placeholder which loads files from both location, use a , seperated location for that (simply putting both in).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #24
    Join Date
    Nov 2007
    Posts
    177

    Default

    Thanks Marten. That fixed it!

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
  •