New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default resolved property value is not working properly [SPR-10619] #15247

Closed
spring-issuemaster opened this Issue Jun 3, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Jun 3, 2013

Andrzej Wisłowski opened SPR-10619 and commented

When using property files configuration like this:

<context:property-placeholder location="classpath:options.properties,
    file:${user.home}/.app/options.properties"
    ignore-resource-not-found="true" ignore-unresolvable="true"/>

and setting property value to the spring component:

<mongo:options auto-connect-retry="true" connections-per-host="40" 
slave-ok="${mongo.slaveOk:false}" />

I got invalid property resolved.

My case is:
In the file classpath:options.properties property filemongo.slaveOk is not set.
In the file ${user.home}/.app/options.properties property is set to true.

Spring is resolving property to value false. It is using default setting if the first location of property files does not contains it.


Affects: 3.2 GA

Issue Links:

  • #14623 Using multiple PropertyPlaceholderConfigurer breaks @Value default value behavior ("duplicates")

Referenced from: commits d7ec20a

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jun 3, 2013

Phil Webb commented

Hi Andrzej,

I have not been able to replicate this issue either with a unit test [1] or a repro project [2].

Could you possibly take a look at modifying the repro project to see if you can make it fail for me?

Cheers

[1] d7ec20a

[2] https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-10619

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jun 4, 2013

Andrzej Wisłowski commented

Hi Phil,

I have debugged this case once again and I have found that I have a problem because I am using a few PropertySourcesPlaceholderConfigurer objects (each for the specific domain)

When I started using default value using : notation, the first one if does not find property in each files subset it is inserting default value in it.

When having many PropertySourcesPlaceholderConfigurert hen the last PropertySourcesPlaceholderConfigurer should set default value.

Regards
Andrzej

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Jul 19, 2013

Phil Webb commented

Thanks for the update, unfortunately this is known restriction at this time. You can find some workarounds in #14623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment