Skip to content
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-projects-issues opened this issue Jun 3, 2013 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression)

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues 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:

Referenced from: commits d7ec20a

@spring-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

spring-projects-issues 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
Labels
in: core Issues in core modules (aop, beans, core, context, expression)
Projects
None yet
Development

No branches or pull requests

2 participants